You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by cmoulliard <cm...@gmail.com> on 2008/11/21 09:32:41 UTC

Strategy to select messages from a queue ?

Hi,

I would like to know if there is a strategy available to select messages
from a queue ? I don't want to remove the messages from a queue but like a
select performed on a DB table, I would like at a certain moment to perform
a query to a queue in order to detect by example "How many messages have
been processed ?", "How many orders have been matched with my settlement
engine" ?
This service is required by a web module.

Idea

>From a web page --> call a Spring Service running on my application server
--> call (? camel)/queue to "select messages according to defined criteria"
--> result returned and displayed in a table

KR,

Charles Moulliard

-----
Enterprise Architect

Xpectis
12, route d'Esch
L-1470 Luxembourg

Phone +352 25 10 70 470
Mobile +352 621 45 36 22

e-mail : cmoulliard@xpectis.com
web site :  www.xpectis.com www.xpectis.com 
My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/  
-- 
View this message in context: http://www.nabble.com/Strategy-to-select-messages-from-a-queue---tp20617081s22882p20617081.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Strategy to select messages from a queue ?

Posted by James Strachan <ja...@gmail.com>.
Browsing queues is a core JMS feature...

http://java.sun.com/j2ee/1.4/docs/api/javax/jms/Session.html#createBrowser(javax.jms.Queue,%20java.lang.String)

so you can do it with JMS code, Camel, command line tools etc


2008/11/24 cmoulliard <cm...@gmail.com>:
>
> Many thanks James.
>
> I presume that for ActiveMq, you means this feature to browse the queues :
>
> http://activemq.apache.org/activemq-command-line-tools-reference.html#ActiveMQCommandLineToolsReference-browse
>
> KR,
>
> Charles
>
>
> James.Strachan wrote:
>>
>> 2008/11/21 cmoulliard <cm...@gmail.com>:
>>>
>>> Many thanks for your reply Claus,
>>>
>>> After performing internet search, I have found that in the JMS
>>> specification, a Selector has been defined to filter messages on the
>>> queue
>>> engine.
>>>
>>> "Selectors are defined using SQL 92 syntax and typically apply to message
>>> headers; whether the standard properties available on a JMS message or
>>> custom headers you can add via the JMS code. ActiveMq has implemented
>>> this :
>>> http://activemq.apache.org/selectors.html."
>>>
>>> The Message selector will not resolve my problem because they allow to
>>> filter messages on the queue engine but not to perform query against
>>> queueing engine.
>>
>> You can browse queues using the queue browser - you can also browse
>> supplying a selector to filter it.
>>
>>> By the way, I'm not really sure that this is a good idea to perform query
>>> against queue(s). This is probably better to save the content of the
>>> messages in a DB and updated them when specific events occur.
>>
>> It depends on your requirements really. Message brokers are designed
>> to support selectors on topics/queues and queue browsing. However
>> selectors are quite simple; they only work on headers on the message.
>> If you want complex queries - or content based queries and you don't
>> want to work in a stream based manner like messaging but want a
>> repository/database of data to process/update/filter on demand
>> whenever, then sure use a database.
>>
>> --
>> James
>> -------
>> http://macstrac.blogspot.com/
>>
>> Open Source Integration
>> http://fusesource.com/
>>
>>
>
>
> -----
> Enterprise Architect
>
> Xpectis
> 12, route d'Esch
> L-1470 Luxembourg
>
> Phone +352 25 10 70 470
> Mobile +352 621 45 36 22
>
> e-mail : cmoulliard@xpectis.com
> web site :  www.xpectis.com www.xpectis.com
> My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/
> --
> View this message in context: http://www.nabble.com/Strategy-to-select-messages-from-a-queue---tp20617081s22882p20658683.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Re: Strategy to select messages from a queue ?

Posted by cmoulliard <cm...@gmail.com>.
Many thanks James.

I presume that for ActiveMq, you means this feature to browse the queues :

http://activemq.apache.org/activemq-command-line-tools-reference.html#ActiveMQCommandLineToolsReference-browse

KR,

Charles


James.Strachan wrote:
> 
> 2008/11/21 cmoulliard <cm...@gmail.com>:
>>
>> Many thanks for your reply Claus,
>>
>> After performing internet search, I have found that in the JMS
>> specification, a Selector has been defined to filter messages on the
>> queue
>> engine.
>>
>> "Selectors are defined using SQL 92 syntax and typically apply to message
>> headers; whether the standard properties available on a JMS message or
>> custom headers you can add via the JMS code. ActiveMq has implemented
>> this :
>> http://activemq.apache.org/selectors.html."
>>
>> The Message selector will not resolve my problem because they allow to
>> filter messages on the queue engine but not to perform query against
>> queueing engine.
> 
> You can browse queues using the queue browser - you can also browse
> supplying a selector to filter it.
> 
>> By the way, I'm not really sure that this is a good idea to perform query
>> against queue(s). This is probably better to save the content of the
>> messages in a DB and updated them when specific events occur.
> 
> It depends on your requirements really. Message brokers are designed
> to support selectors on topics/queues and queue browsing. However
> selectors are quite simple; they only work on headers on the message.
> If you want complex queries - or content based queries and you don't
> want to work in a stream based manner like messaging but want a
> repository/database of data to process/update/filter on demand
> whenever, then sure use a database.
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://fusesource.com/
> 
> 


-----
Enterprise Architect

Xpectis
12, route d'Esch
L-1470 Luxembourg

Phone +352 25 10 70 470
Mobile +352 621 45 36 22

e-mail : cmoulliard@xpectis.com
web site :  www.xpectis.com www.xpectis.com 
My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/  
-- 
View this message in context: http://www.nabble.com/Strategy-to-select-messages-from-a-queue---tp20617081s22882p20658683.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Strategy to select messages from a queue ?

Posted by James Strachan <ja...@gmail.com>.
2008/11/21 cmoulliard <cm...@gmail.com>:
>
> Many thanks for your reply Claus,
>
> After performing internet search, I have found that in the JMS
> specification, a Selector has been defined to filter messages on the queue
> engine.
>
> "Selectors are defined using SQL 92 syntax and typically apply to message
> headers; whether the standard properties available on a JMS message or
> custom headers you can add via the JMS code. ActiveMq has implemented this :
> http://activemq.apache.org/selectors.html."
>
> The Message selector will not resolve my problem because they allow to
> filter messages on the queue engine but not to perform query against
> queueing engine.

You can browse queues using the queue browser - you can also browse
supplying a selector to filter it.

> By the way, I'm not really sure that this is a good idea to perform query
> against queue(s). This is probably better to save the content of the
> messages in a DB and updated them when specific events occur.

It depends on your requirements really. Message brokers are designed
to support selectors on topics/queues and queue browsing. However
selectors are quite simple; they only work on headers on the message.
If you want complex queries - or content based queries and you don't
want to work in a stream based manner like messaging but want a
repository/database of data to process/update/filter on demand
whenever, then sure use a database.

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Re: Strategy to select messages from a queue ?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Yeah as I understand it the JMS message selector is for the consumer
to select certain messages while it listen for messages. So you can't
use it to only *browse*.

But the JMS provider might have propertery API to get meta data about
the queue such as queue size and all kind of other stuff.

However this is more suitable for the ActiveMQ users or if James S. was around.


/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/



On Fri, Nov 21, 2008 at 2:51 PM, cmoulliard <cm...@gmail.com> wrote:
>
> Many thanks for your reply Claus,
>
> After performing internet search, I have found that in the JMS
> specification, a Selector has been defined to filter messages on the queue
> engine.
>
> "Selectors are defined using SQL 92 syntax and typically apply to message
> headers; whether the standard properties available on a JMS message or
> custom headers you can add via the JMS code. ActiveMq has implemented this :
> http://activemq.apache.org/selectors.html."
>
> The Message selector will not resolve my problem because they allow to
> filter messages on the queue engine but not to perform query against
> queueing engine.
>
> By the way, I'm not really sure that this is a good idea to perform query
> against queue(s). This is probably better to save the content of the
> messages in a DB and updated them when specific events occur.
>
> KR,
>
> Charles
>
>
>
> Claus Ibsen-2 wrote:
>>
>> Hi
>>
>> The activeMQ forum might help since it's something to do with browsing
>> a JMS queue. As I recall the JMS spec isn't very strong in this area
>> so I think you need to collect the metrics yourself.
>>
>> Camel is using JMX instrumentation to gather stats for how many
>> exchanges has been consumed, and some basic elapsed time etc. See the
>> JMX console page:
>> http://activemq.apache.org/camel/camel-jmx.html
>>
>> And there is the list component (to be renamed to browse in Camel 2.0)
>> http://activemq.apache.org/camel/list.html
>>
>>
>>
>> /Claus Ibsen
>> Apache Camel Committer
>> Blog: http://davsclaus.blogspot.com/
>>
>>
>>
>> On Fri, Nov 21, 2008 at 9:32 AM, cmoulliard <cm...@gmail.com> wrote:
>>>
>>> Hi,
>>>
>>> I would like to know if there is a strategy available to select messages
>>> from a queue ? I don't want to remove the messages from a queue but like
>>> a
>>> select performed on a DB table, I would like at a certain moment to
>>> perform
>>> a query to a queue in order to detect by example "How many messages have
>>> been processed ?", "How many orders have been matched with my settlement
>>> engine" ?
>>> This service is required by a web module.
>>>
>>> Idea
>>>
>>> From a web page --> call a Spring Service running on my application
>>> server
>>> --> call (? camel)/queue to "select messages according to defined
>>> criteria"
>>> --> result returned and displayed in a table
>>>
>>> KR,
>>>
>>> Charles Moulliard
>>>
>>> -----
>>> Enterprise Architect
>>>
>>> Xpectis
>>> 12, route d'Esch
>>> L-1470 Luxembourg
>>>
>>> Phone +352 25 10 70 470
>>> Mobile +352 621 45 36 22
>>>
>>> e-mail : cmoulliard@xpectis.com
>>> web site :  www.xpectis.com www.xpectis.com
>>> My Blog :  http://cmoulliard.blogspot.com/
>>> http://cmoulliard.blogspot.com/
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Strategy-to-select-messages-from-a-queue---tp20617081s22882p20617081.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>
>
> -----
> Enterprise Architect
>
> Xpectis
> 12, route d'Esch
> L-1470 Luxembourg
>
> Phone +352 25 10 70 470
> Mobile +352 621 45 36 22
>
> e-mail : cmoulliard@xpectis.com
> web site :  www.xpectis.com www.xpectis.com
> My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/
> --
> View this message in context: http://www.nabble.com/Strategy-to-select-messages-from-a-queue---tp20617081s22882p20621437.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Re: Strategy to select messages from a queue ?

Posted by cmoulliard <cm...@gmail.com>.
Many thanks for your reply Claus,

After performing internet search, I have found that in the JMS
specification, a Selector has been defined to filter messages on the queue
engine. 

"Selectors are defined using SQL 92 syntax and typically apply to message
headers; whether the standard properties available on a JMS message or
custom headers you can add via the JMS code. ActiveMq has implemented this :
http://activemq.apache.org/selectors.html."

The Message selector will not resolve my problem because they allow to
filter messages on the queue engine but not to perform query against
queueing engine.

By the way, I'm not really sure that this is a good idea to perform query
against queue(s). This is probably better to save the content of the
messages in a DB and updated them when specific events occur.

KR,

Charles



Claus Ibsen-2 wrote:
> 
> Hi
> 
> The activeMQ forum might help since it's something to do with browsing
> a JMS queue. As I recall the JMS spec isn't very strong in this area
> so I think you need to collect the metrics yourself.
> 
> Camel is using JMX instrumentation to gather stats for how many
> exchanges has been consumed, and some basic elapsed time etc. See the
> JMX console page:
> http://activemq.apache.org/camel/camel-jmx.html
> 
> And there is the list component (to be renamed to browse in Camel 2.0)
> http://activemq.apache.org/camel/list.html
> 
> 
> 
> /Claus Ibsen
> Apache Camel Committer
> Blog: http://davsclaus.blogspot.com/
> 
> 
> 
> On Fri, Nov 21, 2008 at 9:32 AM, cmoulliard <cm...@gmail.com> wrote:
>>
>> Hi,
>>
>> I would like to know if there is a strategy available to select messages
>> from a queue ? I don't want to remove the messages from a queue but like
>> a
>> select performed on a DB table, I would like at a certain moment to
>> perform
>> a query to a queue in order to detect by example "How many messages have
>> been processed ?", "How many orders have been matched with my settlement
>> engine" ?
>> This service is required by a web module.
>>
>> Idea
>>
>> From a web page --> call a Spring Service running on my application
>> server
>> --> call (? camel)/queue to "select messages according to defined
>> criteria"
>> --> result returned and displayed in a table
>>
>> KR,
>>
>> Charles Moulliard
>>
>> -----
>> Enterprise Architect
>>
>> Xpectis
>> 12, route d'Esch
>> L-1470 Luxembourg
>>
>> Phone +352 25 10 70 470
>> Mobile +352 621 45 36 22
>>
>> e-mail : cmoulliard@xpectis.com
>> web site :  www.xpectis.com www.xpectis.com
>> My Blog :  http://cmoulliard.blogspot.com/
>> http://cmoulliard.blogspot.com/
>> --
>> View this message in context:
>> http://www.nabble.com/Strategy-to-select-messages-from-a-queue---tp20617081s22882p20617081.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 


-----
Enterprise Architect

Xpectis
12, route d'Esch
L-1470 Luxembourg

Phone +352 25 10 70 470
Mobile +352 621 45 36 22

e-mail : cmoulliard@xpectis.com
web site :  www.xpectis.com www.xpectis.com 
My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/  
-- 
View this message in context: http://www.nabble.com/Strategy-to-select-messages-from-a-queue---tp20617081s22882p20621437.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Strategy to select messages from a queue ?

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

The activeMQ forum might help since it's something to do with browsing
a JMS queue. As I recall the JMS spec isn't very strong in this area
so I think you need to collect the metrics yourself.

Camel is using JMX instrumentation to gather stats for how many
exchanges has been consumed, and some basic elapsed time etc. See the
JMX console page:
http://activemq.apache.org/camel/camel-jmx.html

And there is the list component (to be renamed to browse in Camel 2.0)
http://activemq.apache.org/camel/list.html



/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/



On Fri, Nov 21, 2008 at 9:32 AM, cmoulliard <cm...@gmail.com> wrote:
>
> Hi,
>
> I would like to know if there is a strategy available to select messages
> from a queue ? I don't want to remove the messages from a queue but like a
> select performed on a DB table, I would like at a certain moment to perform
> a query to a queue in order to detect by example "How many messages have
> been processed ?", "How many orders have been matched with my settlement
> engine" ?
> This service is required by a web module.
>
> Idea
>
> From a web page --> call a Spring Service running on my application server
> --> call (? camel)/queue to "select messages according to defined criteria"
> --> result returned and displayed in a table
>
> KR,
>
> Charles Moulliard
>
> -----
> Enterprise Architect
>
> Xpectis
> 12, route d'Esch
> L-1470 Luxembourg
>
> Phone +352 25 10 70 470
> Mobile +352 621 45 36 22
>
> e-mail : cmoulliard@xpectis.com
> web site :  www.xpectis.com www.xpectis.com
> My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/
> --
> View this message in context: http://www.nabble.com/Strategy-to-select-messages-from-a-queue---tp20617081s22882p20617081.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>