Sticky load balancing

View: New views
5 Messages — Rating Filter:   Alert me  

Sticky load balancing

by Hans Raj :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The clustering approach is exactly something I was looking for (creating an Order Matching system). But I don't really understand how to make sure an exclusive consumer can be used, i.e. how to force a JMSXGroupId in Lingo as described on the ActiveMQ messages & groups page.

Can this perhaps be configured in the Spring AppContext xml when setting up your consumer? No idea where to start. Help much appreciated.


* FYI: My OrderCrosser Consumer interface:

public interface OrderCrosser {

        void registerSellSideCallBack(SellSideCallBack callBack)
                throws OrderCrosserException;
       
        boolean isOnBook(String clOrdId);
       
        boolean isArchived(String clOrdId);
       
        Order getOrder(String clOrdId);
       
        void matchOrder(Order order);
       
        void removeOrder(Order order,boolean cancel);
       
        void modifyOrder(Order order, Double price, Long quantity);
}

Basically I'd like to make sure that all orders with the same instrument: order.getTradedInstrument() use the same exclusive consumer.


Re: Sticky load balancing

by Sanjiv Jivan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've gone down the path a long time ago.. I logged an issue with a complete Lingo example with build file and all.. you may want to play around with it.

http://issues.apache.org/activemq/browse/AMQ-762

Also check out this thread :

http://www.nabble.com/detaching-message-group-affinity-tf1801568.html#a4945541

Sanjiv

On 12/6/06, Hans Raj <hansraj.verma@...> wrote:

The  http://lingo.codehaus.org/Clustering clustering  approach is exactly
something I was looking for (creating an Order Matching system). But I don't
really understand how to make sure an exclusive consumer can be used, i.e.
how to force a JMSXGroupId in Lingo as described on the
http://activemq.org/Message+Groups ActiveMQ messages & groups  page.

Can this perhaps be configured in the Spring AppContext xml when setting up
your consumer? No idea where to start. Help much appreciated.


* FYI: My OrderCrosser Consumer interface:

public interface OrderCrosser {

        void registerSellSideCallBack(SellSideCallBack callBack)
                throws OrderCrosserException;

        boolean isOnBook(String clOrdId);

        boolean isArchived(String clOrdId);

        Order getOrder(String clOrdId);

        void matchOrder(Order order);

        void removeOrder(Order order,boolean cancel);

        void modifyOrder(Order order, Double price, Long quantity);
}

Basically I'd like to make sure that all orders with the same instrument:
order.getTradedInstrument() use the same exclusive consumer.


--
View this message in context: http://www.nabble.com/Sticky-load-balancing-tf2771947.html#a7731787
Sent from the lingo - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email



Re: Sticky load balancing

by James.Strachan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 12/7/06, Hans Raj <hansraj.verma@...> wrote:
> The  http://lingo.codehaus.org/Clustering clustering  approach is exactly
> something I was looking for (creating an Order Matching system). But I don't
> really understand how to make sure an exclusive consumer can be used, i.e.
> how to force a JMSXGroupId in Lingo as described on the
> http://activemq.org/Message+Groups ActiveMQ messages & groups  page.

You can just provide your own DefaultMarshaler provider so that you
can create a JMSXGroupID value you can set on the request messages. So
overload the appendMessageHeaders() method and create some JMSXGroupId
from the Order

--

James
-------
http://radio.weblogs.com/0112098/

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Re: Sticky load balancing

by Hans Raj :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

James.Strachan wrote:
You can just provide your own DefaultMarshaler provider so that you
can create a JMSXGroupID value you can set on the request messages. So
overload the appendMessageHeaders() method and create some JMSXGroupId
from the Order

James
Ok, so there is no other way than subclassing DefaultMarshaler?
I can see a setMarshaler method for JMSClientInterceptor. Does that mean I'd have to "split out" the JMSProxyFactoryBean bean definition in the Spring config to use a specific JMSClientInterceptor? I'd like to understand at what point I would inject my OrderMarshaler.

What about the getStickySessionID()? Where does it get its value from? I don't see a setStickySessionID() in DefaultMarshaler. Please correct me if this is not related to setting a JMSXGroupID.

Re: Sticky load balancing

by James.Strachan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 12/7/06, Hans Raj <hansraj.verma@...> wrote:

> James.Strachan wrote:
> >
> > You can just provide your own DefaultMarshaler provider so that you
> > can create a JMSXGroupID value you can set on the request messages. So
> > overload the appendMessageHeaders() method and create some JMSXGroupId
> > from the Order
> >
> > James
> >
>
> Ok, so there is no other way than subclassing DefaultMarshaler?

Not currently. One day we might be able to hack up a clever enough
implementation which could analyse the types of the parameters to try
see if there's an annotation on a parameter or property of a parameter
to indicate its a JMS property and auto-bind it.


> I can see a setMarshaler method for JMSClientInterceptor. Does that mean I'd
> have to "split out" the JMSProxyFactoryBean bean definition in the Spring
> config to use a specific JMSClientInterceptor? I'd like to understand at
> what point I would inject my OrderMarshaler.
>
> What about the getStickySessionID()? Where does it get its value from? I
> don't see a setStickySessionID() in DefaultMarshaler. Please correct me if
> this is not related to setting a JMSXGroupID.

The JMSXGroupID property is the 'sticky session ID'

--

James
-------
http://radio.weblogs.com/0112098/

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

LightInTheBox - Buy quality products at wholesale price