Hi Di,

Other than your direct use of the destination implementation objects
as opposed to using JNDI or sesion.createQueue() calls I dont see
anything particularly wrong with your code below, but could you post
the complete reproducer code just in case?  There has been some change
on trunk since your post (apologies for the delay) so it would also be
useful if you ran the test again. We will take a look eitiher way.

Thanks,
Robbie

On 1 December 2011 11:20, dizhi...@gmail.com <dizhi...@gmail.com> wrote:
> Hi,
>
> I check out the source code from SVN trunk, build java qpid-0.15 broker.
> I meet some problems about how to manage connection and sessions.
>
> My Code:
>
>                Connection connection = this.getConnection();
>                Session session = null;
>                try {
>                        session = connection.createSession(false,
>                                        Session.AUTO_ACKNOWLEDGE);
>                        AMQAnyDestination dest = new AMQAnyDestination(new 
> AMQShortString(
>                                        "amq.topic"), new 
> AMQShortString("topic"),
>                                        new AMQShortString(routingKey), false, 
> false,
>                                        new AMQShortString(routingKey), true, 
> null);
>
>                        MessageProducer messageProducer = 
> session.createProducer(dest);
>                        ObjectMessage message = 
> session.createObjectMessage(objectMessage);
>                        messageProducer.send(message);
>                        messageProducer.close();
>                        session.close();
>                } catch (JMSException e) {
>                        logger.warn("sendTopicMessage failed." + e);
>                } finally {
>                        forceClose(session);
>                }
>
> The getConnection() method always return the same connection object, i only
> close the session here.
> I run these code more then 100 times, I got the following exceptions.
>
> 1.ERROR [taskExecutor-2][2011-12-01
> 18:22:44,749][org.apache.qpid.client.AMQConnection]: Throwable Received but
> no listener set: org.apache.qpid.AMQException: timed out waiting for sync:
> complete = 2, point = 3 [error code 541: internal error]
>
> 2.receive failed.javax.jms.JMSException: Error registering consumer:
>
> 3.receive failed.javax.jms.IllegalStateException: Object AMQConnection:
>
> thanks for your advice..
>
> -Di
>
>
>
>
>
>
> --
> View this message in context: 
> http://apache-qpid-users.2158936.n2.nabble.com/Connection-and-session-management-tp7050173p7050173.html
> Sent from the Apache Qpid users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscr...@qpid.apache.org
>

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscr...@qpid.apache.org

Reply via email to