Dynamic JMS Selectors Configuration

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamic JMS Selectors Configuration

efender
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.
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic JMS Selectors Configuration

jstrachan
2009/1/14 efender <[hidden email]>:

>
> 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/
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic JMS Selectors Configuration

efender
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'

<quote author="James.Strachan">
2009/1/14 efender <eric+nabble@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/

</quote>
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic JMS Selectors Configuration

jstrachan
2009/1/14 efender <[hidden email]>:
>
> 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/
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic JMS Selectors Configuration

efender
James.Strachan wrote
Ah my bad - its a change on trunk to allow zero arg construction.
Is trunk 1.5.x or 2.x?
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic JMS Selectors Configuration

Claus Ibsen-2
On Thu, Jan 15, 2009 at 6:01 PM, efender <[hidden email]> 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/