Hi,

This is an interesting question. I don't think the SCA specification defines the behavior.

Let's taking the example that an SCA java component service is configured with JMS binding. There will be two pieces in the picture.

1) The JMS message listener registered by the Tuscany/SCA JMS binding provider 2) The instance(s) of the target java component implementation that is used to dispatch the incoming JMS requests

1 is controlled by the behavior of JMS message listener. By the JMS spec, the session used to create the message consumer serializes the execution of all message listeners registered with the session. At any time, only one of the session's message listeners is running. Each session must insure that it passes messages serially to the listener. This means that a listener assigned to one or more consumers of the same session can assume that the onMessage method is not called with the next message until the session has completed the last call.

2 is controlled by the scope of the java component. If it is composite scoped, the same instance will be used. If it is stateless scoped, a brand new instance or an instance from the object pool will be picked. BTW, the same instance doesn't mean the dispatching has to be sequential and it's possible that the same instance is invoked concurrently.

When 1 delegates the requests to 2, it's not clear if we can pass the messages concurrently or sequentially. I will have to get some clarifications from the spec group. Maybe we need to have an Intent to control the desired behavior.

Thanks,
Raymond
--------------------------------------------------
From: "Ali, Haneef" <[email protected]>
Sent: Monday, May 04, 2009 12:40 PM
To: <[email protected]>
Subject: How to create a multiple instance of a service?

Hi,

I have 2 services. Both the services are created with composite scope.

 a) Webservice which puts the incoming request in a queue
 b) A JMS service which takes the message from the queue and process it.


Even though there are more message in the queue, the JMS service is processing it sequentially. Is it because of "Composite scope" Is there a way to increase the number of instances of the JMS service?

In pure J2EE we can increase the MDB count. How to do this in Tuscany since it uses MDB underneath?


Thanks,
Haneef


Reply via email to