You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Rajesh Khan <ra...@gmail.com> on 2012/11/29 06:41:22 UTC

What if a a message is sent and then a connection is instantly closed after that ?

I have something like this in my C++ code due to certain reasons.And wanted
to know if messages are sent this way and its effect on the broker

    sender.send(message);
    connection__->close();
    return true;

If thousands of messages are sent every second in the above method what
would be the affect on the broker. Any suggestions ?

RE: What if a a message is sent and then a connection is instantly closed after that ?

Posted by Jan Bares <ja...@wood.cz>.
> > It works fine but after sending several thousands messages I got very
> strange error:
> >
> > javax.jms.IllegalStateException: Object AMQConnection:
> > Host: prgesbclu
> > Port: 5672
> > Virtual Host: test
> > Client ID: clientid
> > Active session count: 0 has been closed
> > 	at
> org.apache.qpid.client.Closeable.checkNotClosed(Closeable.java:70)
> > 	at
> org.apache.qpid.client.AMQConnection.createSession(AMQConnection.java
> :616)
> > 	at
> org.apache.qpid.client.AMQConnection.createSession(AMQConnection.java
> :608)
> > 	at
> org.apache.qpid.client.AMQConnection.createSession(AMQConnection.java
> :602)
> > 	at
> org.apache.qpid.client.AMQConnection.createSession(AMQConnection.java
> :82)
> > 	at
> calypsox.tk.bo.document.PSEDocumentSender.sendImpl(PSEDocumentSen
> der.java:104)
> > 	at
> calypsox.tk.bo.document.CommonDocumentSender.send(CommonDocume
> ntSender.java:231)
> > 	at
> com.calypso.engine.advice.SenderEngine.handleEvent(SenderEngine.java:3
> 42)
> > 	at
> com.calypso.engine.advice.SenderEngine.process(SenderEngine.java:204)
> > 	at com.calypso.engine.Engine$EngineThread.run(Engine.java:1041)
> 
> Hmmm... are there any errors in the broker logs (or any preceding errors
> on the client)... I would report this by JIRA, if you have a simple
> reproducer that would be ideal. One guess is that the wrapping around of
> channel ids might be at fault(?), but that is pure speculation.

Thanks for your ideas, I am working on simple reproducer and I will be back soon.

Kind regards, Jan





DISCLAIMER
WOOD & Company Financial Services, a.s. and its branches are authorized and regulated by the CNB as Home State regulator and in Poland by the KNF, in Romania by the CNVM, in Slovakia by the NBS and in the UK by the FSA as Host State regulators.  For further information about WOOD & Co., its investment services, financial instruments and associated risks, safeguard client assets (incl. compensation schemes) and contractual relationship please see our website at www.wood.cz under section Corporate Governance. 

Unless otherwise stated, this transmission is neither an offer nor the solicitation of an offer to sell or purchase any investment. All estimates, opinions and other information contained herein are subject to change without notice and are provided in good faith but without legal responsibility or liability. Opinion may be personal to the author and may not reflect the opinions of WOOD & Co. Communications from sales persons, sales traders or traders should not be regarded as investment research and may contain opinions or trading ideas which are different from WOOD & Co. investment  research opinions. 

This e-mail and any attachments are confidential and may be privileged or otherwise protected from disclosure. If you are not a named addressee you must not use, disclose, distribute, copy, print or rely on this e-mail and any of its attachments. Please notify the sender that you have received this email by mistake by replying to the email, and then delete the email and any copies of it. Although WOOD & Co. routinely screens e-mails for viruses, addressees should scan this e-mail and any attachments for viruses. WOOD & Co. makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of our clients and business, we may monitor and read e-mails sent to and from our server(s).



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: What if a a message is sent and then a connection is instantly closed after that ?

Posted by Gordon Sim <gs...@redhat.com>.
On 11/29/2012 11:55 AM, Jan Bares wrote:
> Hi,
>
> does this recommendation also apply to Java JMS client? I have a connection open all the time and create session, send message, close session for each message to be sent.

Opening and closing a *session* for each message is a lot less expensive 
than opening and closing a *connection*. It is still more work than 
reusing a session of course, but that may not be a big deal in a given 
scenario.

> It works fine but after sending several thousands messages I got very strange error:
>
> javax.jms.IllegalStateException: Object AMQConnection:
> Host: prgesbclu
> Port: 5672
> Virtual Host: test
> Client ID: clientid
> Active session count: 0 has been closed
> 	at org.apache.qpid.client.Closeable.checkNotClosed(Closeable.java:70)
> 	at org.apache.qpid.client.AMQConnection.createSession(AMQConnection.java:616)
> 	at org.apache.qpid.client.AMQConnection.createSession(AMQConnection.java:608)
> 	at org.apache.qpid.client.AMQConnection.createSession(AMQConnection.java:602)
> 	at org.apache.qpid.client.AMQConnection.createSession(AMQConnection.java:82)
> 	at calypsox.tk.bo.document.PSEDocumentSender.sendImpl(PSEDocumentSender.java:104)
> 	at calypsox.tk.bo.document.CommonDocumentSender.send(CommonDocumentSender.java:231)
> 	at com.calypso.engine.advice.SenderEngine.handleEvent(SenderEngine.java:342)
> 	at com.calypso.engine.advice.SenderEngine.process(SenderEngine.java:204)
> 	at com.calypso.engine.Engine$EngineThread.run(Engine.java:1041)

Hmmm... are there any errors in the broker logs (or any preceding errors 
on the client)... I would report this by JIRA, if you have a simple 
reproducer that would be ideal. One guess is that the wrapping around of 
channel ids might be at fault(?), but that is pure speculation.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


RE: What if a a message is sent and then a connection is instantly closed after that ?

Posted by Jan Bares <ja...@wood.cz>.
Hi,

does this recommendation also apply to Java JMS client? I have a connection open all the time and create session, send message, close session for each message to be sent. It works fine but after sending several thousands messages I got very strange error:

javax.jms.IllegalStateException: Object AMQConnection:
Host: prgesbclu
Port: 5672
Virtual Host: test
Client ID: clientid
Active session count: 0 has been closed
	at org.apache.qpid.client.Closeable.checkNotClosed(Closeable.java:70)
	at org.apache.qpid.client.AMQConnection.createSession(AMQConnection.java:616)
	at org.apache.qpid.client.AMQConnection.createSession(AMQConnection.java:608)
	at org.apache.qpid.client.AMQConnection.createSession(AMQConnection.java:602)
	at org.apache.qpid.client.AMQConnection.createSession(AMQConnection.java:82)
	at calypsox.tk.bo.document.PSEDocumentSender.sendImpl(PSEDocumentSender.java:104)
	at calypsox.tk.bo.document.CommonDocumentSender.send(CommonDocumentSender.java:231)
	at com.calypso.engine.advice.SenderEngine.handleEvent(SenderEngine.java:342)
	at com.calypso.engine.advice.SenderEngine.process(SenderEngine.java:204)
	at com.calypso.engine.Engine$EngineThread.run(Engine.java:1041)

Thanks, Jan

> -----Original Message-----
> From: Gordon Sim [mailto:gsim@redhat.com]
> Sent: Thursday, November 29, 2012 11:48 AM
> To: users@qpid.apache.org
> Subject: Re: What if a a message is sent and then a connection is instantly
> closed after that ?
> 
> On 11/29/2012 05:41 AM, Rajesh Khan wrote:
> > I have something like this in my C++ code due to certain reasons.And
> wanted
> > to know if messages are sent this way and its effect on the broker
> >
> >      sender.send(message);
> >      connection__->close();
> >      return true;
> >
> > If thousands of messages are sent every second in the above method what
> > would be the affect on the broker. Any suggestions ?
> 
> For an explicit close like that, the client will wait until the sent
> message is received by the broker before closing the connection.
> 
> Opening a connection and going through the AMQP 0-10 handshake is quite
> involved and can take some time. So in general opening and closing a
> connection for every message is something I would avoid if at all possible.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org





DISCLAIMER
WOOD & Company Financial Services, a.s. and its branches are authorized and regulated by the CNB as Home State regulator and in Poland by the KNF, in Romania by the CNVM, in Slovakia by the NBS and in the UK by the FSA as Host State regulators.  For further information about WOOD & Co., its investment services, financial instruments and associated risks, safeguard client assets (incl. compensation schemes) and contractual relationship please see our website at www.wood.cz under section Corporate Governance. 

Unless otherwise stated, this transmission is neither an offer nor the solicitation of an offer to sell or purchase any investment. All estimates, opinions and other information contained herein are subject to change without notice and are provided in good faith but without legal responsibility or liability. Opinion may be personal to the author and may not reflect the opinions of WOOD & Co. Communications from sales persons, sales traders or traders should not be regarded as investment research and may contain opinions or trading ideas which are different from WOOD & Co. investment  research opinions. 

This e-mail and any attachments are confidential and may be privileged or otherwise protected from disclosure. If you are not a named addressee you must not use, disclose, distribute, copy, print or rely on this e-mail and any of its attachments. Please notify the sender that you have received this email by mistake by replying to the email, and then delete the email and any copies of it. Although WOOD & Co. routinely screens e-mails for viruses, addressees should scan this e-mail and any attachments for viruses. WOOD & Co. makes no representation or warranty as to the absence of viruses in this e-mail or any attachments. Please note that to ensure regulatory compliance and for the protection of our clients and business, we may monitor and read e-mails sent to and from our server(s).



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org


Re: What if a a message is sent and then a connection is instantly closed after that ?

Posted by Gordon Sim <gs...@redhat.com>.
On 11/29/2012 05:41 AM, Rajesh Khan wrote:
> I have something like this in my C++ code due to certain reasons.And wanted
> to know if messages are sent this way and its effect on the broker
>
>      sender.send(message);
>      connection__->close();
>      return true;
>
> If thousands of messages are sent every second in the above method what
> would be the affect on the broker. Any suggestions ?

For an explicit close like that, the client will wait until the sent 
message is received by the broker before closing the connection.

Opening a connection and going through the AMQP 0-10 handshake is quite 
involved and can take some time. So in general opening and closing a 
connection for every message is something I would avoid if at all possible.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org