You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Pablo Rodríguez Rey <mr...@xkr.es> on 2013/07/05 16:30:40 UTC

Starting with AMQ+AMQP 1.0+QPID Proton

Hello,

I'm Pablo, from the IT of the University of Murcia. I'm new to the Message
Queue Services and I've registered here to learn more about ActiveMQ
day-to-day activity.

Also, I've a question about mixing AMQP 1.0 Filters/Selectors. I don't know
how to make a selector for filtering the Priority of a message. I have a
cluster of 6 machines with 3 workers each. 2 are low-priority workers and
can do any video transcode work with any priority, and 1 reserved worker
with higher priority only for user-time transcoding.

I've seen these pages:

https://svn.apache.org/repos/asf/qpid/trunk/qpid/specs/apache-filters.xml#type-selector-filter
http://activemq.apache.org/amqp.html
https://cwiki.apache.org/confluence/display/ACTIVEMQ/AMQP

I can send and receive messages using AMQP URLs:

amqp://127.0.0.1/route

But I dont know how to set the paramers to active the selector/filters for
selecting only messages with priority=5 or priority>5 (examples), tried a
lot of combinations:

amqp://127.0.0.1/route?header.priority=5
amqp://127.0.0.1/route?header.priority%3E5
amqp://127.0.0.1/route?transport.transformer=jms&priority=E5
amqp://127.0.0.1/route?transport.transformer=jms&priority%3E5
amqp://127.0.0.1/route?transport.transformer=jms&header.priority=E5
amqp://127.0.0.1/route?transport.transformer=jms&header.priority%3E5
...

There is no examples on the wiki or documentation to achieve this, so any
help will be apreciated.

Thanks for your time,
best regards.

-- 
Pablo Rodríguez Rey (http://mr.xkr.es)
Area de Tecnologías de la Información y las Comunicaciones Aplicadas
Edificio ATICA ~ Sección de Redes ~ Despacho B1.2.004 ~ Tel. 868 88 8209
Universidad de Murcia, 30100 Campus de Espinardo (Murcia - Spain)
"i've mapped my mind on my dick"

Re: Starting with AMQ+AMQP 1.0+QPID Proton

Posted by Pablo Rodríguez Rey <mr...@xkr.es>.
Producer:
-------------

include("proton.php");

$mess = new Messenger();
$mess->start();

$msg = new Message();
$msg->address="amqp://127.0.0.1/xxx2/asd/asd";
$msg->body="Test";

for ($i=1;$i<=9;$i++) {
    $msg->priority=(int)$i;
    $msg->subject="PRIORITY(".$i.")!";
    $mess->put($msg);
    $mess->send();
    print "sent: $msg->subject\n";
}

$mess->stop();

Consumer:
----------------

include("proton.php");

$mess = new Messenger();
$mess->start();
$mess->subscribe($argv[1]);

$msg = new Message();
while (true) {
  $mess->recv(10);
  while ($mess->incoming) {
    try {
      $mess->get($msg);
    } catch (Exception $e) {
      print "$e\n";
      continue;
    }
    print "$msg->address, $msg->subject, $msg->body\n";
  }
}

$mess->stop();

Where $argv[1] is an AMQP address.

In QPID Proton API there is no such class member like ->filter, ->selector
or ->JMSSelector.

Thanks for your replies.


On Mon, Jul 8, 2013 at 7:01 PM, Christian Posta
<ch...@gmail.com>wrote:

> Pablo,
>
> You should be able to specify jms-like selectors.
> It's not going to work by specifying it on the transport connector.
> You would specify it in a 'jms-selector' header when your consumer connects
> up. Can you show the code your consumer uses?
>
>
> On Mon, Jul 8, 2013 at 12:20 PM, Pablo Rodríguez Rey <mr...@xkr.es> wrote:
>
> > I reply you between lines.
> >
> > On Mon, Jul 8, 2013 at 6:01 PM, Gordon Sim <gs...@redhat.com> wrote:
> >
> > > On 07/05/2013 03:30 PM, Pablo Rodríguez Rey wrote:
> > >
> > >> Also, I've a question about mixing AMQP 1.0 Filters/Selectors. I don't
> > >> know
> > >> how to make a selector for filtering the Priority of a message. I
> have a
> > >> cluster of 6 machines with 3 workers each. 2 are low-priority workers
> > and
> > >> can do any video transcode work with any priority, and 1 reserved
> worker
> > >> with higher priority only for user-time transcoding.
> > >>
> > >> I've seen these pages:
> > >>
> > >> https://svn.apache.org/repos/**asf/qpid/trunk/qpid/specs/**
> > >> apache-filters.xml#type-**selector-filter<
> >
> https://svn.apache.org/repos/asf/qpid/trunk/qpid/specs/apache-filters.xml#type-selector-filter
> > >
> > >>
> > >
> > > Note that the selector filter described there is an extension to the
> core
> > > AMQP 1.0 protocol...
> > >
> > >
> > Yes, I know it's an apache proposal for AMQP.
> >
> >
> > >
> > >  http://activemq.apache.org/**amqp.html<
> > http://activemq.apache.org/amqp.html>
> > >> https://cwiki.apache.org/**confluence/display/ACTIVEMQ/**AMQP<
> > https://cwiki.apache.org/confluence/display/ACTIVEMQ/AMQP>
> > >>
> > >> I can send and receive messages using AMQP URLs:
> > >>
> > >> amqp://127.0.0.1/route
> > >>
> > >> But I dont know how to set the paramers to active the selector/filters
> > for
> > >> selecting only messages with priority=5 or priority>5 (examples),
> tried
> > a
> > >> lot of combinations:
> > >>
> > >> amqp://127.0.0.1/route?header.**priority=5<
> > http://127.0.0.1/route?header.priority=5>
> > >> amqp://127.0.0.1/route?header.**priority%3E5<
> > http://127.0.0.1/route?header.priority%3E5>
> > >> amqp://127.0.0.1/route?**transport.transformer=jms&**priority=E5<
> > http://127.0.0.1/route?transport.transformer=jms&priority=E5>
> > >> amqp://127.0.0.1/route?**transport.transformer=jms&**priority%3E5<
> > http://127.0.0.1/route?transport.transformer=jms&priority%3E5>
> > >> amqp://
> 127.0.0.1/route?**transport.transformer=jms&**header.priority=E5
> > <http://127.0.0.1/route?transport.transformer=jms&header.priority=E5>
> > >> amqp://
> > 127.0.0.1/route?**transport.transformer=jms&**header.priority%3E5<
> > http://127.0.0.1/route?transport.transformer=jms&header.priority%3E5>
> > >> ...
> > >>
> > >
> > > First, I don't believe the the Qpid Proton Messenger API (which I
> assume
> > > from the subject is what you are using?) provides any way to set a
> filter
> > > on attach.
> > >
> > >
> > In deed, there is no Proton API for doing that, so I guessed it will be
> > only available using parameters in AMQP address.
> >
> >
> > > Second, though I could be wrong as I too am new to ActiveMQ, it also
> > looks
> > > like the AMQP transport for ActiveMQ does not support the selector
> filter
> > > extension(?). Certainly in my experiments it doesn't apply any
> filtering.
> > >
> >
> > I don't know so, I did several trys but the only thing I need to do is
> find
> > in the source code of ActiveMQ.
> >
> > Thanks.
> >
> >
> > --
> > Pablo Rodríguez Rey (http://mr.xkr.es)
> > Area de Tecnologías de la Información y las Comunicaciones Aplicadas
> > Edificio ATICA ~ Sección de Redes ~ Despacho B1.2.004 ~ Tel. 868 88 8209
> > Universidad de Murcia, 30100 Campus de Espinardo (Murcia - Spain)
> > "i've mapped my mind on my dick"
> >
>
>
>
> --
> *Christian Posta*
> http://www.christianposta.com/blog
> twitter: @christianposta
>



-- 
Pablo Rodríguez Rey (http://mr.xkr.es)
Area de Tecnologías de la Información y las Comunicaciones Aplicadas
Edificio ATICA ~ Sección de Redes ~ Despacho B1.2.004 ~ Tel. 868 88 8209
Universidad de Murcia, 30100 Campus de Espinardo (Murcia - Spain)
"i've mapped my mind on my dick"

Re: Starting with AMQ+AMQP 1.0+QPID Proton

Posted by Christian Posta <ch...@gmail.com>.
Pablo,

You should be able to specify jms-like selectors.
It's not going to work by specifying it on the transport connector.
You would specify it in a 'jms-selector' header when your consumer connects
up. Can you show the code your consumer uses?


On Mon, Jul 8, 2013 at 12:20 PM, Pablo Rodríguez Rey <mr...@xkr.es> wrote:

> I reply you between lines.
>
> On Mon, Jul 8, 2013 at 6:01 PM, Gordon Sim <gs...@redhat.com> wrote:
>
> > On 07/05/2013 03:30 PM, Pablo Rodríguez Rey wrote:
> >
> >> Also, I've a question about mixing AMQP 1.0 Filters/Selectors. I don't
> >> know
> >> how to make a selector for filtering the Priority of a message. I have a
> >> cluster of 6 machines with 3 workers each. 2 are low-priority workers
> and
> >> can do any video transcode work with any priority, and 1 reserved worker
> >> with higher priority only for user-time transcoding.
> >>
> >> I've seen these pages:
> >>
> >> https://svn.apache.org/repos/**asf/qpid/trunk/qpid/specs/**
> >> apache-filters.xml#type-**selector-filter<
> https://svn.apache.org/repos/asf/qpid/trunk/qpid/specs/apache-filters.xml#type-selector-filter
> >
> >>
> >
> > Note that the selector filter described there is an extension to the core
> > AMQP 1.0 protocol...
> >
> >
> Yes, I know it's an apache proposal for AMQP.
>
>
> >
> >  http://activemq.apache.org/**amqp.html<
> http://activemq.apache.org/amqp.html>
> >> https://cwiki.apache.org/**confluence/display/ACTIVEMQ/**AMQP<
> https://cwiki.apache.org/confluence/display/ACTIVEMQ/AMQP>
> >>
> >> I can send and receive messages using AMQP URLs:
> >>
> >> amqp://127.0.0.1/route
> >>
> >> But I dont know how to set the paramers to active the selector/filters
> for
> >> selecting only messages with priority=5 or priority>5 (examples), tried
> a
> >> lot of combinations:
> >>
> >> amqp://127.0.0.1/route?header.**priority=5<
> http://127.0.0.1/route?header.priority=5>
> >> amqp://127.0.0.1/route?header.**priority%3E5<
> http://127.0.0.1/route?header.priority%3E5>
> >> amqp://127.0.0.1/route?**transport.transformer=jms&**priority=E5<
> http://127.0.0.1/route?transport.transformer=jms&priority=E5>
> >> amqp://127.0.0.1/route?**transport.transformer=jms&**priority%3E5<
> http://127.0.0.1/route?transport.transformer=jms&priority%3E5>
> >> amqp://127.0.0.1/route?**transport.transformer=jms&**header.priority=E5
> <http://127.0.0.1/route?transport.transformer=jms&header.priority=E5>
> >> amqp://
> 127.0.0.1/route?**transport.transformer=jms&**header.priority%3E5<
> http://127.0.0.1/route?transport.transformer=jms&header.priority%3E5>
> >> ...
> >>
> >
> > First, I don't believe the the Qpid Proton Messenger API (which I assume
> > from the subject is what you are using?) provides any way to set a filter
> > on attach.
> >
> >
> In deed, there is no Proton API for doing that, so I guessed it will be
> only available using parameters in AMQP address.
>
>
> > Second, though I could be wrong as I too am new to ActiveMQ, it also
> looks
> > like the AMQP transport for ActiveMQ does not support the selector filter
> > extension(?). Certainly in my experiments it doesn't apply any filtering.
> >
>
> I don't know so, I did several trys but the only thing I need to do is find
> in the source code of ActiveMQ.
>
> Thanks.
>
>
> --
> Pablo Rodríguez Rey (http://mr.xkr.es)
> Area de Tecnologías de la Información y las Comunicaciones Aplicadas
> Edificio ATICA ~ Sección de Redes ~ Despacho B1.2.004 ~ Tel. 868 88 8209
> Universidad de Murcia, 30100 Campus de Espinardo (Murcia - Spain)
> "i've mapped my mind on my dick"
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: Starting with AMQ+AMQP 1.0+QPID Proton

Posted by Christian Posta <ch...@gmail.com>.
Yep, misspoke. It was the qpid jms stuff i linked too :)



On Mon, Jul 8, 2013 at 2:03 PM, Gordon Sim <gs...@redhat.com> wrote:

> On 07/08/2013 06:52 PM, Christian Posta wrote:
>
>> Don't think messenger API supports using filters/selectors.
>>
>
> It does not (neither directly through the API, nor through any special
> syntax in the addresses).
>
> Is it possible to express a selector in the string passed to
> ActiveMQDestination.**createDestination()? I assumed not, but I don't
> know what the UnresolvableDestinationTransfo**rmer is capable of.
>
> I think that may have been what Pablo was hoping for?
>
>
>  Might have to ask on their mailing list.
>>
>> You can definitely do it with the proton apis however since the jms impl
>> does it :)
>>
>
> There are two 'parts' to the proton toolkit and the protocol engine does
> provide access to filters (thats what ActiveMQ uses to get at them also),
> but the messenger does not.
>
>  http://svn.apache.org/viewvc/**qpid/trunk/qpid/java/amqp-1-0-**
>> client-jms/src/main/java/org/**apache/qpid/amqp_1_0/jms/impl/**
>> MessageConsumerImpl.java?view=**markup<http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java?view=markup>
>>
>
> (That doesn't actually use proton.)
>
>
>
>
>


-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: Starting with AMQ+AMQP 1.0+QPID Proton

Posted by Gordon Sim <gs...@redhat.com>.
On 07/08/2013 06:52 PM, Christian Posta wrote:
> Don't think messenger API supports using filters/selectors.

It does not (neither directly through the API, nor through any special 
syntax in the addresses).

Is it possible to express a selector in the string passed to 
ActiveMQDestination.createDestination()? I assumed not, but I don't know 
what the UnresolvableDestinationTransformer is capable of.

I think that may have been what Pablo was hoping for?

> Might have to ask on their mailing list.
>
> You can definitely do it with the proton apis however since the jms impl
> does it :)

There are two 'parts' to the proton toolkit and the protocol engine does 
provide access to filters (thats what ActiveMQ uses to get at them 
also), but the messenger does not.

> http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java?view=markup

(That doesn't actually use proton.)





Re: Starting with AMQ+AMQP 1.0+QPID Proton

Posted by Christian Posta <ch...@gmail.com>.
Don't think messenger API supports using filters/selectors.
Might have to ask on their mailing list.

You can definitely do it with the proton apis however since the jms impl
does it :)

http://svn.apache.org/viewvc/qpid/trunk/qpid/java/amqp-1-0-client-jms/src/main/java/org/apache/qpid/amqp_1_0/jms/impl/MessageConsumerImpl.java?view=markup

Python client looks like it does too.


On Mon, Jul 8, 2013 at 1:41 PM, Gordon Sim <gs...@redhat.com> wrote:

> On 07/08/2013 06:20 PM, Pablo Rodríguez Rey wrote:
>
>> Tested with JMS names, but still ignores them:
>>
>> $ php recv.php "amqp://
>> 127.0.0.1/xxx2/asd/asd?**transport.transformer=jms&**JMSPriority%3E5<http://127.0.0.1/xxx2/asd/asd?transport.transformer=jms&JMSPriority%3E5>
>> "
>>
>
> Ok, so that will result in the 'xxx2/asd/asd?transport.**
> transformer=jms&JMSPriority%**3E5' being sent as the address filed of the
> source, which will then be passed to ActiveMQDestination.**createDestination().
> I assume you are expecting ActiveMQ to parse that somehow? (I initially
> thought you expected proton messenger to parse it and set the filter in the
> proper AMQP 1.0 field).
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: Starting with AMQ+AMQP 1.0+QPID Proton

Posted by Gordon Sim <gs...@redhat.com>.
On 07/08/2013 06:20 PM, Pablo Rodríguez Rey wrote:
> Tested with JMS names, but still ignores them:
>
> $ php recv.php "amqp://
> 127.0.0.1/xxx2/asd/asd?transport.transformer=jms&JMSPriority%3E5"

Ok, so that will result in the 
'xxx2/asd/asd?transport.transformer=jms&JMSPriority%3E5' being sent as 
the address filed of the source, which will then be passed to 
ActiveMQDestination.createDestination(). I assume you are expecting 
ActiveMQ to parse that somehow? (I initially thought you expected proton 
messenger to parse it and set the filter in the proper AMQP 1.0 field).

Re: Starting with AMQ+AMQP 1.0+QPID Proton

Posted by Pablo Rodríguez Rey <mr...@xkr.es>.
Tested with JMS names, but still ignores them:

$ php recv.php "amqp://
127.0.0.1/xxx2/asd/asd?transport.transformer=jms&JMSPriority%3E5"


On Mon, Jul 8, 2013 at 6:59 PM, Gordon Sim <gs...@redhat.com> wrote:

> On 07/08/2013 05:20 PM, Pablo Rodríguez Rey wrote:
>
>> On Mon, Jul 8, 2013 at 6:01 PM, Gordon Sim <gs...@redhat.com> wrote:
>>
>>> On 07/05/2013 03:30 PM, Pablo Rodríguez Rey wrote:
>>>
>>>> I can send and receive messages using AMQP URLs:
>>>>
>>>> amqp://127.0.0.1/route
>>>>
>>>> But I dont know how to set the paramers to active the selector/filters
>>>> for
>>>> selecting only messages with priority=5 or priority>5 (examples), tried
>>>> a
>>>> lot of combinations:
>>>>
>>>> amqp://127.0.0.1/route?header.****priority=5<http://127.0.0.1/route?header.**priority=5>
>>>> <http://127.0.0.1/**route?header.priority=5<http://127.0.0.1/route?header.priority=5>
>>>> >
>>>> amqp://127.0.0.1/route?header.****priority%3E5<http://127.0.0.1/route?header.**priority%3E5>
>>>> <http://127.0.0.**1/route?header.priority%3E5<http://127.0.0.1/route?header.priority%3E5>
>>>> >
>>>> amqp://127.0.0.1/route?****transport.transformer=jms&****priority=E5<http://127.0.0.1/route?**transport.transformer=jms&**priority=E5>
>>>> <http://127.0.0.1/**route?transport.transformer=**jms&priority=E5<http://127.0.0.1/route?transport.transformer=jms&priority=E5>
>>>> >
>>>> amqp://127.0.0.1/route?****transport.transformer=jms&****priority%3E5<http://127.0.0.1/route?**transport.transformer=jms&**priority%3E5>
>>>> <http://127.0.0.1/**route?transport.transformer=**jms&priority%3E5<http://127.0.0.1/route?transport.transformer=jms&priority%3E5>
>>>> >
>>>> amqp://127.0.0.1/route?****transport.transformer=jms&****
>>>> header.priority=E5<http://127.0.0.1/route?**transport.transformer=jms&**header.priority=E5>
>>>> <http://127.**0.0.1/route?transport.**transformer=jms&header.**
>>>> priority=E5<http://127.0.0.1/route?transport.transformer=jms&header.priority=E5>
>>>> >
>>>> amqp://127.0.0.1/route?****transport.transformer=jms&****
>>>> header.priority%3E5<http://127.0.0.1/route?**transport.transformer=jms&**header.priority%3E5>
>>>> <http://**127.0.0.1/route?transport.**transformer=jms&header.**
>>>> priority%3E5<http://127.0.0.1/route?transport.transformer=jms&header.priority%3E5>
>>>> >
>>>> ...
>>>>
>>>>
>>> First, I don't believe the the Qpid Proton Messenger API (which I assume
>>> from the subject is what you are using?) provides any way to set a filter
>>> on attach.
>>>
>>>
>>>  In deed, there is no Proton API for doing that, so I guessed it will be
>> only available using parameters in AMQP address.
>>
>
> It isn't available that way either. The filter is a specific field on the
> source for the attach request and the proton-c messenger only ever sets the
> address on the source, never the filter.
>
>
>  Second, though I could be wrong as I too am new to ActiveMQ, it also looks
>>> like the AMQP transport for ActiveMQ does not support the selector filter
>>> extension(?). Certainly in my experiments it doesn't apply any filtering.
>>>
>>>
>> I don't know so, I did several trys but the only thing I need to do is
>> find
>> in the source code of ActiveMQ.
>>
>
> Turns out I was indeed wrong (all too common I'm afraid)! Your suggestion
> to look at the source code showed that ActiveMQ _does_ support a filter,
> but it requires the name to be jms-selector (and doesn't care about the
> descriptor used).
>
> (Also the filter supported uses JMS names rather than the translated names
> for AMQP as described in https://svn.apache.org/repos/**
> asf/qpid/trunk/qpid/specs/**apache-filters.xml#type-**selector-filter<https://svn.apache.org/repos/asf/qpid/trunk/qpid/specs/apache-filters.xml#type-selector-filter>,
> e.g. in this case the selector would be 'JMSPriority > 5', which does
> indeed work as expected).
>
>


-- 
Pablo Rodríguez Rey (http://mr.xkr.es)
Area de Tecnologías de la Información y las Comunicaciones Aplicadas
Edificio ATICA ~ Sección de Redes ~ Despacho B1.2.004 ~ Tel. 868 88 8209
Universidad de Murcia, 30100 Campus de Espinardo (Murcia - Spain)
"i've mapped my mind on my dick"

Re: Starting with AMQ+AMQP 1.0+QPID Proton

Posted by Gordon Sim <gs...@redhat.com>.
On 07/08/2013 05:20 PM, Pablo Rodríguez Rey wrote:
> On Mon, Jul 8, 2013 at 6:01 PM, Gordon Sim <gs...@redhat.com> wrote:
>> On 07/05/2013 03:30 PM, Pablo Rodríguez Rey wrote:
>>> I can send and receive messages using AMQP URLs:
>>>
>>> amqp://127.0.0.1/route
>>>
>>> But I dont know how to set the paramers to active the selector/filters for
>>> selecting only messages with priority=5 or priority>5 (examples), tried a
>>> lot of combinations:
>>>
>>> amqp://127.0.0.1/route?header.**priority=5<http://127.0.0.1/route?header.priority=5>
>>> amqp://127.0.0.1/route?header.**priority%3E5<http://127.0.0.1/route?header.priority%3E5>
>>> amqp://127.0.0.1/route?**transport.transformer=jms&**priority=E5<http://127.0.0.1/route?transport.transformer=jms&priority=E5>
>>> amqp://127.0.0.1/route?**transport.transformer=jms&**priority%3E5<http://127.0.0.1/route?transport.transformer=jms&priority%3E5>
>>> amqp://127.0.0.1/route?**transport.transformer=jms&**header.priority=E5<http://127.0.0.1/route?transport.transformer=jms&header.priority=E5>
>>> amqp://127.0.0.1/route?**transport.transformer=jms&**header.priority%3E5<http://127.0.0.1/route?transport.transformer=jms&header.priority%3E5>
>>> ...
>>>
>>
>> First, I don't believe the the Qpid Proton Messenger API (which I assume
>> from the subject is what you are using?) provides any way to set a filter
>> on attach.
>>
>>
> In deed, there is no Proton API for doing that, so I guessed it will be
> only available using parameters in AMQP address.

It isn't available that way either. The filter is a specific field on 
the source for the attach request and the proton-c messenger only ever 
sets the address on the source, never the filter.

>> Second, though I could be wrong as I too am new to ActiveMQ, it also looks
>> like the AMQP transport for ActiveMQ does not support the selector filter
>> extension(?). Certainly in my experiments it doesn't apply any filtering.
>>
>
> I don't know so, I did several trys but the only thing I need to do is find
> in the source code of ActiveMQ.

Turns out I was indeed wrong (all too common I'm afraid)! Your 
suggestion to look at the source code showed that ActiveMQ _does_ 
support a filter, but it requires the name to be jms-selector (and 
doesn't care about the descriptor used).

(Also the filter supported uses JMS names rather than the translated 
names for AMQP as described in 
https://svn.apache.org/repos/asf/qpid/trunk/qpid/specs/apache-filters.xml#type-selector-filter, 
e.g. in this case the selector would be 'JMSPriority > 5', which does 
indeed work as expected).


Re: Starting with AMQ+AMQP 1.0+QPID Proton

Posted by Pablo Rodríguez Rey <mr...@xkr.es>.
I reply you between lines.

On Mon, Jul 8, 2013 at 6:01 PM, Gordon Sim <gs...@redhat.com> wrote:

> On 07/05/2013 03:30 PM, Pablo Rodríguez Rey wrote:
>
>> Also, I've a question about mixing AMQP 1.0 Filters/Selectors. I don't
>> know
>> how to make a selector for filtering the Priority of a message. I have a
>> cluster of 6 machines with 3 workers each. 2 are low-priority workers and
>> can do any video transcode work with any priority, and 1 reserved worker
>> with higher priority only for user-time transcoding.
>>
>> I've seen these pages:
>>
>> https://svn.apache.org/repos/**asf/qpid/trunk/qpid/specs/**
>> apache-filters.xml#type-**selector-filter<https://svn.apache.org/repos/asf/qpid/trunk/qpid/specs/apache-filters.xml#type-selector-filter>
>>
>
> Note that the selector filter described there is an extension to the core
> AMQP 1.0 protocol...
>
>
Yes, I know it's an apache proposal for AMQP.


>
>  http://activemq.apache.org/**amqp.html<http://activemq.apache.org/amqp.html>
>> https://cwiki.apache.org/**confluence/display/ACTIVEMQ/**AMQP<https://cwiki.apache.org/confluence/display/ACTIVEMQ/AMQP>
>>
>> I can send and receive messages using AMQP URLs:
>>
>> amqp://127.0.0.1/route
>>
>> But I dont know how to set the paramers to active the selector/filters for
>> selecting only messages with priority=5 or priority>5 (examples), tried a
>> lot of combinations:
>>
>> amqp://127.0.0.1/route?header.**priority=5<http://127.0.0.1/route?header.priority=5>
>> amqp://127.0.0.1/route?header.**priority%3E5<http://127.0.0.1/route?header.priority%3E5>
>> amqp://127.0.0.1/route?**transport.transformer=jms&**priority=E5<http://127.0.0.1/route?transport.transformer=jms&priority=E5>
>> amqp://127.0.0.1/route?**transport.transformer=jms&**priority%3E5<http://127.0.0.1/route?transport.transformer=jms&priority%3E5>
>> amqp://127.0.0.1/route?**transport.transformer=jms&**header.priority=E5<http://127.0.0.1/route?transport.transformer=jms&header.priority=E5>
>> amqp://127.0.0.1/route?**transport.transformer=jms&**header.priority%3E5<http://127.0.0.1/route?transport.transformer=jms&header.priority%3E5>
>> ...
>>
>
> First, I don't believe the the Qpid Proton Messenger API (which I assume
> from the subject is what you are using?) provides any way to set a filter
> on attach.
>
>
In deed, there is no Proton API for doing that, so I guessed it will be
only available using parameters in AMQP address.


> Second, though I could be wrong as I too am new to ActiveMQ, it also looks
> like the AMQP transport for ActiveMQ does not support the selector filter
> extension(?). Certainly in my experiments it doesn't apply any filtering.
>

I don't know so, I did several trys but the only thing I need to do is find
in the source code of ActiveMQ.

Thanks.


-- 
Pablo Rodríguez Rey (http://mr.xkr.es)
Area de Tecnologías de la Información y las Comunicaciones Aplicadas
Edificio ATICA ~ Sección de Redes ~ Despacho B1.2.004 ~ Tel. 868 88 8209
Universidad de Murcia, 30100 Campus de Espinardo (Murcia - Spain)
"i've mapped my mind on my dick"

Re: Starting with AMQ+AMQP 1.0+QPID Proton

Posted by Gordon Sim <gs...@redhat.com>.
On 07/05/2013 03:30 PM, Pablo Rodríguez Rey wrote:
> Also, I've a question about mixing AMQP 1.0 Filters/Selectors. I don't know
> how to make a selector for filtering the Priority of a message. I have a
> cluster of 6 machines with 3 workers each. 2 are low-priority workers and
> can do any video transcode work with any priority, and 1 reserved worker
> with higher priority only for user-time transcoding.
>
> I've seen these pages:
>
> https://svn.apache.org/repos/asf/qpid/trunk/qpid/specs/apache-filters.xml#type-selector-filter

Note that the selector filter described there is an extension to the 
core AMQP 1.0 protocol...

> http://activemq.apache.org/amqp.html
> https://cwiki.apache.org/confluence/display/ACTIVEMQ/AMQP
>
> I can send and receive messages using AMQP URLs:
>
> amqp://127.0.0.1/route
>
> But I dont know how to set the paramers to active the selector/filters for
> selecting only messages with priority=5 or priority>5 (examples), tried a
> lot of combinations:
>
> amqp://127.0.0.1/route?header.priority=5
> amqp://127.0.0.1/route?header.priority%3E5
> amqp://127.0.0.1/route?transport.transformer=jms&priority=E5
> amqp://127.0.0.1/route?transport.transformer=jms&priority%3E5
> amqp://127.0.0.1/route?transport.transformer=jms&header.priority=E5
> amqp://127.0.0.1/route?transport.transformer=jms&header.priority%3E5
> ...

First, I don't believe the the Qpid Proton Messenger API (which I assume 
from the subject is what you are using?) provides any way to set a 
filter on attach.

Second, though I could be wrong as I too am new to ActiveMQ, it also 
looks like the AMQP transport for ActiveMQ does not support the selector 
filter extension(?). Certainly in my experiments it doesn't apply any 
filtering.