qpid-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rajith Attapattu <rajit...@gmail.com>
Subject Re: qpid Java client keeps sending messages even if underlying session/connection does not exist
Date Mon, 14 May 2012 16:53:10 GMT
Just to add to Alex's note,
On the flip side, If you select sync_publish it will affect performance
quite a bit.

Rajith

On Mon, May 14, 2012 at 10:28 AM, Oleksandr Rudyy <orudyy@gmail.com> wrote:

> Hi Shyamal,
>
> By default, MessageProducer#send operation is asynchronous, i.e. a
> message is put on a wire and producer does not wait for the broker
> confirmation.
>
> You can make this operation synchronous by setting JVM system property
> -Dsync_publish=all or -Dsync_publish=persistent or through connection
> URL option sync_publish.
>
> Setting sync_publish=persistent will make publisher to sync only
> persistent messages, whilst setting sync_publish=all will make
> publisher to sync both transient and persistent messages.
>
> This setting is only applicable for 0.10 amqp client (which is the
> default).
>
> Kind Regards,
> Alex
>
> On 12 May 2012 11:45, Shyamal Pandya1 <Shyamal_Pandya1@symantec.com>
> wrote:
> > Hi,
> >
> > I have a C++ QPID broker, to which a Java client sends messages
> (asynchronously). The broker and client versions are 0.14. I also have the
> qpid message store enabled.
> >
> > Whenever the queue reaches 80 % of its capacity, the broker closes the
> underlying session/connection. I verify this by running qpid-stat -c and
> see no connections from the client.
> > However, the client somehow keeps sending messages, there is no
> exception thrown. Only when a session.sync() is perform does it time out
> with a "Session DETACHED" error.
> >
> > Is this a bug, or am I doing something wrong?
> >
> > Code snippet:
> >
> >        try
> >        {
> >            buffer.position(0);
> >
> >            BytesMessage msg = qpidSession.createBytesMessage();
> >
> >            msg.setJMSDeliveryMode(DeliveryMode.PERSISTENT);
> >
> >            msg.writeBytes(buffer.array());
> >
> >            publisher.publish(msg); // Shouldn't this throw an exception
> if the underlying connection is no longer there?
> >
> >            // sync after every N messages
> >            if(++msgCount >= MSG_SYNC_COUNT)
> >            {
> >                qpidSession.sync(); // This is where the error is thrown.
> >                msgCount = 0;
> >            }
> >
> >        }
> >        catch (JMSException e)
> >        {
> >            if (e.getErrorCode() != null)
> >            {
> >                log.error("JMSException error code: " + e.getErrorCode());
> >            }
> >
> >            if (e.getLinkedException() != null)
> >            {
> >                log.error("JMSException linked exception: "+ e);
> >            }
> >
> >            connected.set(false);
> >            throw e;
> >        }
> >
> >
> > Thanks,
> > Shyamal
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message