This seems to be probable bug for new jms:consumer endpoint (for durable
subscription):
   
We are using new jms:consumer endpoints in our application for
publish-subscribe using topic. As we are 
having multiple subscribers we are specifying unique clientID as part of
endpoint configuration. We tried
above suggested step by Bruce but still we are facing same error. We did
some troubleshooting on our 
end to identify where could be the actual problem. Following are the steps
we did:
    1) Modified the source code for ActiveMQ to have debug statements in the
setClientID(newClientID) 
method and updated the jar file in ServiceMix with custom built version.
    2) On ServiceMix start we see the logs being printed by JMSFlow class
which directly talks to 
ActiveMQ.
    3) The same logs are not printed during initialization of our
jms-consumer SU. This means that the 
setClientID() method is never invoked for ActiveMQ connection. Difference
between jms-consumer 
endpoint (JmsConsumerEndpoint) implementation and JMSFlow is that the
JmsConsumerEndpoint class 
is using Spring to interact with ActiveMQ.
    4) We have also browsed through the Spring code and everything seems to
be fine. There is  method 
prepareSharedConnection(Connection connection) in
AbstractJmsListeningContainer class. This method 
actually sets the clientID to ActiveMQ connection object.
    
    code:  protected void prepareSharedConnection(Connection connection)
throws JMSException {
                String clientId = getClientId();
                if (clientId != null) {
                        connection.setClientID(clientId);
                }
        }

  5) So, this method should execute before executing
org.apache.activemq.ActiveMQConnection.checkClientIDWasManuallySpecified().
Based on the log it is 
clear that the preparedSharedConnection() method is not invoked.

  6) And that leads to throwing JMSException:

javax.jms.JMSException: You cannot create a durable subscriber without
specifying a unique clientID on 
a Connection
        at 
org.apache.activemq.ActiveMQConnection.checkClientIDWasManuallySpecified(ActiveMQConnection.java:1142)
        at
org.apache.activemq.ActiveMQSession.createDurableSubscriber(ActiveMQSession.java:1066)
        at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.createConsumer(AbstractPollingMessageListenerContainer.java:429)
        at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.createListenerConsumer(AbstractPollingMessageListenerContainer.java:216)
        at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:297)
        at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:254)
        at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:871)
        at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:811)
        at java.lang.Thread.run(Thread.java:595)

Above findings seem to point to bug in JmsConsumerEndpoint. Please review
it.
We need to use new jms-endpoint as we require "messageSelector" which is not
possible with jms:endpoint (old).

Please help.

Sandeep


sandeep reddy wrote:
> 
> Hi Bruce,
> 
>     Thanks for reply.
>     I tried the way you suggested but it's again the same one.
>     If you see the error it says that I need to mention with a unique
> clientId.And that's what I am doing.
> 
> ERROR - DefaultMessageListenerContainer - Setup of JMS message listener
> invoker failed - trying to recover
> javax.jms.JMSException: You cannot create a durable subscriber without
> specifying a unique clientID on a Connection
>         at
> org.apache.activemq.ActiveMQConnection.checkClientIDWasManuallySpecified(ActiveMQConnection.java:1138)
>         at
> org.apache.activemq.ActiveMQSession.createDurableSubscriber(ActiveMQSession.java:1066)
> 
> And I don't know might be this is bug for spring framework.Please help me
> ........
> 
> Thanks,
> Sandeep.
> 
> 
> bsnyder wrote:
>> 
>> On Sun, Jul 6, 2008 at 10:17 PM, sandeep reddy <[EMAIL PROTECTED]>
>> wrote:
>>>
>>> Hi All,
>>>
>>>    Still i am not able to resolve this problem.I didn't understand is
>>> that
>>> nobody came across this problem,
>>> or else some thing missing in above configuration.
>> 
>> Have you tried removing the clientId attribute from each
>> configuration? This value needs to be unique, it can't be a static
>> value as it causes the error you're seeing.
>> 
>> Bruce
>> -- 
>> perl -e 'print
>> unpack("u30","D0G)[EMAIL PROTECTED]&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>> );'
>> 
>> Apache ActiveMQ - http://activemq.org/
>> Apache Camel - http://activemq.org/camel/
>> Apache ServiceMix - http://servicemix.org/
>> 
>> Blog: http://bruceblog.org/
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Error-in-setting-up-durable-subscriber-tp18256291p18341531.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to