This is my current problem:
I am using the Publisher/Subscriber model deployed under weblogic 8.1 (Express) using the JMS 1.0.2b implementation.
I am unable to use the J2EE container to supply JMS as I am restricted by the Weblogic Express license, so the idea was to use ActiveMQ & Spring to provide the messaging framework.
Current architecture has one publisher and multiple subscribers. Each subscriber is responsible for retrieving different data from different suppliers. Each subscriber has a pool of message listeners attached to accomplish this data retrieval.
I have used an example from the ActiveMQ (org.codehaus.activemq.jca.TargetSourceMessageList ener) and the Spring's CommonsPoolTargetSource to create the pool.
Each subscriber is started at deployment.
TargetSourceMessageListener listener; //set by Spring Context
JmsTemplate102 template; //set by Spring
ConnectionFactory factory = template.getConnectionFactory();
connection = ((TopicConnectionFactory)factory).createTopicConnection();
TopicSession session = connection.createTopicSession(false, Session.CLIENT_ACKNOWLEDGE);
TopicSubscriber subscriber = session.createSubscriber((Topic)destination);
Spring context file:
The idea of this was that the Subscriber, calls the onMessage() of the TargetSourceMessageListener and this retrieves a Message Listener (ML) from the pool, calls the onMessage on that ML and then releases the connection when its finished. Unfortunately this is all done by Subscriber thread and until the ML finishes its business, only then is the ML released back to the pool. Not exactly brilliant for handling multiple concurrent requests. Where have I gone wrong? What I am missing?
<bean id="pooledSearch" class="org.codehaus.activemq.jca.TargetSourceMessageListener">
<bean id="pooledListenerTargetSource" class="org.springframework.aop.target.CommonsPoolTargetSource">
<bean id="pooledListeners" class="uk.co.bred.SearchMessageListener" singleton="false">
What I want it do to is each time a message is published, I want each subscriber to retrieve a ML in a new thread, allowing it go off and do it's thing and if another message comes along, the Subscriber retrieves another ML, without waiting for the first ML to finish. Does this make sense?
Could JCA be the solution? If so how? If not, what else? What of Message-Driven POJO's?
Appreciate any help, thanks, Andrew.