You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by efender <er...@fender.net> on 2009/01/14 18:12:00 UTC

Dynamic JMS Selectors Configuration

We have servers deployed in several tiers.  Servers should only consume
messages generated by itself or other members of the tier.  I'm implementing
this with a JMS message selector.  The problem is that the configuration is
a bit ugly:

<bean id="blockUserEndpoint" parent="baseBlockUserMasterEndpoint"
class="org.apache.camel.component.jms.JmsQueueEndpoint">
	<constructor-arg index="0" type="java.lang.String"
value="blockUserJms:queue:BlockUserQueue"/>
	<constructor-arg index="1"
type="org.apache.camel.component.jms.JmsComponent" ref="blockUserJms"/>
	<constructor-arg index="2" type="java.lang.String" value="BlockUserQueue"/>
	<constructor-arg index="3"
type="org.apache.camel.component.jms.JmsConfiguration"
ref="jmsConfiguration"/>
	<property name="camelContext" ref="blockUserCamelContext"/>
	<property name="selector" ref="tierSelector"/>
</bean>


Is there any way to do it more like this? (within my camelContext
definition)
<endpoint id="blockUserMasterEndpoint"
uri="blockUserJms:queue:BlockUserMasterQueue">
    <selector ref="tierSelector"/>
</endpoint>

Thanks.
-- 
View this message in context: http://www.nabble.com/Dynamic-JMS-Selectors-Configuration-tp21460479s22882p21460479.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Dynamic JMS Selectors Configuration

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jan 15, 2009 at 6:01 PM, efender <er...@fender.net> wrote:
>
>
> James.Strachan wrote:
>>
>> Ah my bad - its a change on trunk to allow zero arg construction.
>
> Is trunk 1.5.x or 2.x?
2.x

> --
> View this message in context: http://www.nabble.com/Dynamic-JMS-Selectors-Configuration-tp21460479s22882p21481922.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
-------
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Dynamic JMS Selectors Configuration

Posted by efender <er...@fender.net>.

James.Strachan wrote:
> 
> Ah my bad - its a change on trunk to allow zero arg construction.

Is trunk 1.5.x or 2.x?
-- 
View this message in context: http://www.nabble.com/Dynamic-JMS-Selectors-Configuration-tp21460479s22882p21481922.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Dynamic JMS Selectors Configuration

Posted by James Strachan <ja...@gmail.com>.
2009/1/14 efender <er...@fender.net>:
>
> I don't see a zero-arg constructor for JmsQueueEndpoint or setters for some
> of those constructor-args, or I would have done that.  I'm using the 1.5
> codebase.  Or am I missing something?

Ah my bad - its a change on trunk to allow zero arg construction.


> I suppose separate queues for each tier might work, but there is also a
> possibility of sending a message to all tiers,

You could always send a message to many queues

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

Open Source Integration
http://fusesource.com/

Re: Dynamic JMS Selectors Configuration

Posted by efender <er...@fender.net>.
I don't see a zero-arg constructor for JmsQueueEndpoint or setters for some
of those constructor-args, or I would have done that.  I'm using the 1.5
codebase.  Or am I missing something?

I suppose separate queues for each tier might work, but there is also a
possibility of sending a message to all tiers, so my selectors look like:

'com_webshots_tier=<some-tier-name> or com_webshots_tier is null'


James.Strachan wrote:
> 
> 2009/1/14 efender <er...@fender.net>:
>>
>> We have servers deployed in several tiers.  Servers should only consume
>> messages generated by itself or other members of the tier.  I'm
>> implementing
>> this with a JMS message selector.  The problem is that the configuration
>> is
>> a bit ugly:
>>
>> <bean id="blockUserEndpoint" parent="baseBlockUserMasterEndpoint"
>> class="org.apache.camel.component.jms.JmsQueueEndpoint">
>>        <constructor-arg index="0" type="java.lang.String"
>> value="blockUserJms:queue:BlockUserQueue"/>
>>        <constructor-arg index="1"
>> type="org.apache.camel.component.jms.JmsComponent" ref="blockUserJms"/>
>>        <constructor-arg index="2" type="java.lang.String"
>> value="BlockUserQueue"/>
>>        <constructor-arg index="3"
>> type="org.apache.camel.component.jms.JmsConfiguration"
>> ref="jmsConfiguration"/>
>>        <property name="camelContext" ref="blockUserCamelContext"/>
>>        <property name="selector" ref="tierSelector"/>
>> </bean>
> 
> Using the zero-arg constructor and properties is maybe a bit cleaner?
> 
> BTW rather than using selectors - why not use a different queue for
> each tier? Only then its easier to browse what each tier is doing
> 
> We could start making mini-Spring XML languages for certain endpoints;
> e.g. <jms:endpoint queue="someQueue" selector="..." ....
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://fusesource.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Dynamic-JMS-Selectors-Configuration-tp21460479s22882p21460929.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Dynamic JMS Selectors Configuration

Posted by James Strachan <ja...@gmail.com>.
2009/1/14 efender <er...@fender.net>:
>
> We have servers deployed in several tiers.  Servers should only consume
> messages generated by itself or other members of the tier.  I'm implementing
> this with a JMS message selector.  The problem is that the configuration is
> a bit ugly:
>
> <bean id="blockUserEndpoint" parent="baseBlockUserMasterEndpoint"
> class="org.apache.camel.component.jms.JmsQueueEndpoint">
>        <constructor-arg index="0" type="java.lang.String"
> value="blockUserJms:queue:BlockUserQueue"/>
>        <constructor-arg index="1"
> type="org.apache.camel.component.jms.JmsComponent" ref="blockUserJms"/>
>        <constructor-arg index="2" type="java.lang.String" value="BlockUserQueue"/>
>        <constructor-arg index="3"
> type="org.apache.camel.component.jms.JmsConfiguration"
> ref="jmsConfiguration"/>
>        <property name="camelContext" ref="blockUserCamelContext"/>
>        <property name="selector" ref="tierSelector"/>
> </bean>

Using the zero-arg constructor and properties is maybe a bit cleaner?

BTW rather than using selectors - why not use a different queue for
each tier? Only then its easier to browse what each tier is doing

We could start making mini-Spring XML languages for certain endpoints;
e.g. <jms:endpoint queue="someQueue" selector="..." ....

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

Open Source Integration
http://fusesource.com/