You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Abhishek Kumar <ma...@gmail.com> on 2018/05/24 11:41:44 UTC

MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Hi Team,

We have created below object using "qpid-jms-client - 0.32.0" .

1. Single javax.jms.Connection
2. With the use of above Connection object created Single
"javax.jms.Session"
3. With the use of above Session object created Single
"javax.jms.MessageConsumer".
     --> With the use of above MessageConsumer, create 4 MessageListener
4. With the use of above Session object created Single
"javax.jms.MessageProducer"


Connection URL - *failover:(amqps://XXXXXXXX.servicebus.windows.net
<http://XXXXXXXX.servicebus.windows.net>)?failover.reconnectDelay=2000&failover.maxReconnectAttempts=-1&failover.warnAfterReconnectAttempts=10&failover.startupMaxReconnectAttempts=3&amqp.idleTimeout=30000&transport.connectTimeout=10&jms.prefetchPolicy.all=1000&jms.forceAsyncSend=true*

BrokerName - Azure ServiceBus

Everything was working fine when i deploy application. I tested
application *after
two days*, then we started facing issue. MessageListener stop listening
message from queue, and producer stop sending message also. We have not
received any error log also.

We need to restart server for resolving this issue. This is very bad
alternative.

Could you please suggest your opinion to resolve this issue.

Regards,
Abhishek Kumar

Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by akabhishek1 <ma...@gmail.com>.
Hi Robbie,

Thanks a lot for your quick reply and suggestions . I will update my source
code with your suggestions and update you accordingly.

Regards,
Abhishek Kumar






--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by Robbie Gemmell <ro...@gmail.com>.
On 24 May 2018 at 16:47, akabhishek1 <ma...@gmail.com> wrote:
> Hi Robbie,
>
> Could you please also suggest, is my connection URL formation wrong? I mean
> transport and jms parameter should be in failover block? I looked in this
> link
> <https://stackoverflow.com/questions/47207557/apache-qpid-jms-client-setting-prefetch-doesnt-work>
> and got confused. Please suggest your opinion.
>

The format is documented with description and examples at:
http://qpid.apache.org/releases/qpid-jms-0.32.0/docs/index.html#failover-configuration-options

> Could you please also suggest, should i use "transport.tcpKeepAlive=true" in
> URL?  Please suggest your opinion for this also.

I dont know, though I will say I have never used the option myself.

>
> Connection URL - *failover:(amqps://XXXXXXXX.servicebus.windows.net
> <http://XXXXXXXX.servicebus.windows.net>)?failover.reconnectDelay=2000&failover.maxReconnectAttempts=-1&failover.warnAfterReconnectAttempts=10&failover.startupMaxReconnectAttempts=3&amqp.idleTimeout=30000&transport.connectTimeout=10&jms.prefetchPolicy.all=1000&jms.forceAsyncSend=true*
>
> Regards,
> Abhishek
>
>
>
>
> --
> Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by akabhishek1 <ma...@gmail.com>.
Hi Robbie,

Could you please also suggest, is my connection URL formation wrong? I mean
transport and jms parameter should be in failover block? I looked in this 
link
<https://stackoverflow.com/questions/47207557/apache-qpid-jms-client-setting-prefetch-doesnt-work>  
and got confused. Please suggest your opinion. 

Could you please also suggest, should i use "transport.tcpKeepAlive=true" in
URL?  Please suggest your opinion for this also. 

Connection URL - *failover:(amqps://XXXXXXXX.servicebus.windows.net 
<http://XXXXXXXX.servicebus.windows.net>)?failover.reconnectDelay=2000&failover.maxReconnectAttempts=-1&failover.warnAfterReconnectAttempts=10&failover.startupMaxReconnectAttempts=3&amqp.idleTimeout=30000&transport.connectTimeout=10&jms.prefetchPolicy.all=1000&jms.forceAsyncSend=true*

Regards,
Abhishek




--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by akabhishek1 <ma...@gmail.com>.
Hi Robbie,

Do you know, how can we replicate this issue? I mean forcefully detach the
link. I am trying to replicate this issue.

Regards,
Abhishek Kumar



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by akabhishek1 <ma...@gmail.com>.
HI Robbie,

Thanks a lot for confirmation. Is it possible for you to fix this issue in
next release? 

Could you please also suggest timeline about availability of this feature,
so i can plan accordingly?

Regards,
Abhishek Kumar



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by akabhishek1 <ma...@gmail.com>.
Hi Robbie,

Thanks a lot for information. I will wait for fixes. 

I am having some issue with producer. I will send new email for avoiding the
confusion.

Regards,
Abhishek Kumar



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by Robbie Gemmell <ro...@gmail.com>.
Unfortunately some issues have been noted with the change on JIRA so
additional change is required.

I'll aim to release a 0.33.0 once its ready to do so. The release
process takes a few days so the timescale is however long it takes to
finalise the changes, plus a few days.

On 5 June 2018 at 12:35, akabhishek1 <ma...@gmail.com> wrote:
> Hi Robbie,
>
> Awesome News. Thank you so much for quick fix.
>
> I cloned jms-client code from master github and build locally. I tested
> locally and it is working fine. I am getting the error as expected.
>
> Could you please also suggest, when are you planning to release 0.33.0
> version? Any lum-sum time/date would be also fine, so i can inform
> internally to my team mates.
>
> Regards,
> Abhishek Kumar
>
>
>
> --
> Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by akabhishek1 <ma...@gmail.com>.
Hi Robbie,

Awesome News. Thank you so much for quick fix. 

I cloned jms-client code from master github and build locally. I tested
locally and it is working fine. I am getting the error as expected.

Could you please also suggest, when are you planning to release 0.33.0
version? Any lum-sum time/date would be also fine, so i can inform
internally to my team mates.

Regards,
Abhishek Kumar



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by Robbie Gemmell <ro...@gmail.com>.
I've made a change to address this via
https://issues.apache.org/jira/browse/QPIDJMS-386. The only workaround
would be to stop using the clients failover provider, as thats what is
interrupting the remote closure handling process from completing.

If you'd like to give the change a try you can either build from
master (e.g https://github.com/apache/qpid-jms) or use a build from
the snapshots repo
(https://repository.apache.org/content/repositories/snapshots/).

Robbie

On 4 June 2018 at 14:02, akabhishek1 <ma...@gmail.com> wrote:
> HI Robbie,
>
> Could you please suggest your opinion, is there any work around for this
> issue, so i can implement same until final fix ?
>
> Regards,
> Abhishek Kumar
>
>
>
> --
> Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by akabhishek1 <ma...@gmail.com>.
HI Robbie, 

Could you please suggest your opinion, is there any work around for this
issue, so i can implement same until final fix ? 

Regards,
Abhishek Kumar



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by Robbie Gemmell <ro...@gmail.com>.
Having a dig at this, it appears there is indeed an issue that mean
the additions in 0.32.0 can't handle the case, meaning the
ExceptionListener wont be fired when the listeners onsumer is remotely
closed with the configuration you are using.

On 2 June 2018 at 18:42, Robbie Gemmell <ro...@gmail.com> wrote:
> Firing the ExceptionListener for the connection when a consumer with a
> MessageListener is remotely closed is something that was added and
> tested only from 0.32.0 onward. Its working under test but its
> possible in other scenarios somethings preventing it happening in
> certain cases, it would need looking at.
>
> Random aside, I find their use of "amqp:link:detach-forced" a bit odd
> in the case you've described given its seeming suitability for the
> "amqp:resource-deleted" error.
>
> On 1 June 2018 at 18:44, akabhishek1 <ma...@gmail.com> wrote:
>> Hi Robbie,
>>
>> Thank you so much for your analysis. I can confirm that there is some issue
>> in Qpid library. I am able to reproduced this issue.
>>
>> Please find below steps to reproduce this issue
>>
>> 1. Change value of "SBUS_NAME, USERNAME, PASSWORD" in below class
>> 2. Run the below classe
>> 3. Send one message on queue to verify the listener is working fine. If
>> running fine then
>> 4. Delete the Queue from ServiceBus - this will enforce to detach the link.
>>
>> If you delete the queue then we can see AMQP detach error but not error from
>> exceptionListener.
>> We can see that, there are no issues pop up in "onException()" operation. if
>> issue does not pop up then we can't re-register listener. Please find below
>> error log.
>>
>> Please suggest your opinion and correct me if i am doing any mistake.
>>
>> Error Log
>>
>> TRACE 2018-06-01 18:15:38,123 [AmqpProvider
>> :(1):[amqps://XXXXXXX.servicebus.windows.net:-1]]
>> org.apache.qpid.jms.provider.amqp.FRAMES: RECV: Detach{handle=0,
>> closed=true, error=Error{condition=amqp:link:detach-forced, description='The
>> link
>> 'G2:71211:qpid-jms:receiver:ID:51428778-b922-4612-9d58-1343134d388a:1:1:1:test-rcvr'
>> is force detached by the broker due to errors occurred in consumer(link40).
>> Detach origin: InnerMessageReceiver was closed.
>> TrackingId:d1fcb94d000001bf000000285b117efe_G2_B3,
>> SystemTracker:XXXXXXX:Queue:test-rcvr, Timestamp:6/1/2018 5:15:38 PM',
>> info=null}}
>> TRACE 2018-06-01 18:15:38,123 [AmqpProvider
>> :(1):[amqps://XXXXXXX.servicebus.windows.net:-1]]
>> org.apache.qpid.jms.provider.amqp.FRAMES: SENT: Detach{handle=0,
>> closed=true, error=null}
>>
>>
>> /////// Sample Code ///////
>> package com.service.connector.example.test;
>>
>> import java.util.Hashtable;
>>
>> import javax.jms.Connection;
>> import javax.jms.ConnectionFactory;
>> import javax.jms.Destination;
>> import javax.jms.ExceptionListener;
>> import javax.jms.JMSException;
>> import javax.jms.MessageConsumer;
>> import javax.jms.MessageListener;
>> import javax.jms.Session;
>> import javax.naming.Context;
>> import javax.naming.InitialContext;
>> import javax.naming.NamingException;
>>
>> public class TestQpidRcvr implements MessageListener, ExceptionListener{
>>
>>         private static final String SBUS_NAME = "XXXXXXX";
>>         private static final String USERNAME = "XXXXXXX";
>>         private static final String PASSWORD = "XXXXXXX";
>>         private static final String QPID_CONNECTION_FACTORY_CLASS =
>> "org.apache.qpid.jms.jndi.JmsInitialContextFactory";
>>
>>         public static void main(String[] args) throws Exception {
>>                 TestQpidRcvr test = new TestQpidRcvr();
>>                 test.startListning();
>>
>>                 //Loop for not terminating the application
>>                 int i = 0;
>>                 while(i > 0){
>>                         i++;
>>                 }
>>         }
>>
>>         /* Enable constructor, if you are running in any logger for server logs
>>
>>          public TestQpidRcvr() throws NamingException, JMSException {
>>                 System.err.println("***** I am in ****");
>>                 startListning();
>>         }*/
>>
>>         private void startListning() throws NamingException, JMSException {
>>                 Hashtable<String, String> hashtable = new Hashtable<>();
>>                 hashtable.put("connectionfactory.SBCF", "failover:(amqps://"+ SBUS_NAME
>> +".servicebus.windows.net?transport.tcpKeepAlive=true&amqp.traceFrames=true)?failover.reconnectDelay=2000&failover.maxReconnectAttempts=-1&failover.warnAfterReconnectAttempts=10&failover.startupMaxReconnectAttempts=3&jms.prefetchPolicy.all=1000&jms.forceAsyncSend=true");
>>
>>                 hashtable.put(Context.INITIAL_CONTEXT_FACTORY,
>> QPID_CONNECTION_FACTORY_CLASS);
>>
>>                 Context context = new InitialContext(hashtable);
>>                 ConnectionFactory connectionFactory = (ConnectionFactory)
>> context.lookup("SBCF");
>>
>>                 Connection connection = connectionFactory.createConnection(USERNAME,
>> PASSWORD);
>>                 connection.setExceptionListener(this); // Settted ExceptionListener
>>                 connection.start();
>>
>>                 Session session = connection.createSession(false,
>> Session.CLIENT_ACKNOWLEDGE);
>>
>>                 System.out.println("createSession :: " + session);
>>                 System.out.println("**** I am connected ****");
>>
>>                 Destination destination = session.createQueue("test-rcvr");
>>                 System.out.println("**** Destination created ****");
>>
>>                 MessageConsumer consumer = session.createConsumer(destination);
>>
>>                 consumer.setMessageListener(this);
>>
>>                 System.out.println("**** Published successfully ****");
>>         }
>>
>>
>>         @Override
>>         public void onMessage(javax.jms.Message message) {
>>                 try {
>>                         System.out.println("Received Message :: " + message.getJMSMessageID());
>>                         message.acknowledge();
>>                 } catch (JMSException e) {
>>                         e.printStackTrace();
>>                 }
>>         }
>>
>>         @Override
>>         public void onException(JMSException exception) {
>>                 System.err.println("*** onException :: exception message :: ***" +
>> exception.getMessage());
>>                 exception.printStackTrace();
>>
>>         }
>>
>> }
>>
>>
>>
>>
>> --
>> Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
>> For additional commands, e-mail: users-help@qpid.apache.org
>>

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by Robbie Gemmell <ro...@gmail.com>.
Firing the ExceptionListener for the connection when a consumer with a
MessageListener is remotely closed is something that was added and
tested only from 0.32.0 onward. Its working under test but its
possible in other scenarios somethings preventing it happening in
certain cases, it would need looking at.

Random aside, I find their use of "amqp:link:detach-forced" a bit odd
in the case you've described given its seeming suitability for the
"amqp:resource-deleted" error.

On 1 June 2018 at 18:44, akabhishek1 <ma...@gmail.com> wrote:
> Hi Robbie,
>
> Thank you so much for your analysis. I can confirm that there is some issue
> in Qpid library. I am able to reproduced this issue.
>
> Please find below steps to reproduce this issue
>
> 1. Change value of "SBUS_NAME, USERNAME, PASSWORD" in below class
> 2. Run the below classe
> 3. Send one message on queue to verify the listener is working fine. If
> running fine then
> 4. Delete the Queue from ServiceBus - this will enforce to detach the link.
>
> If you delete the queue then we can see AMQP detach error but not error from
> exceptionListener.
> We can see that, there are no issues pop up in "onException()" operation. if
> issue does not pop up then we can't re-register listener. Please find below
> error log.
>
> Please suggest your opinion and correct me if i am doing any mistake.
>
> Error Log
>
> TRACE 2018-06-01 18:15:38,123 [AmqpProvider
> :(1):[amqps://XXXXXXX.servicebus.windows.net:-1]]
> org.apache.qpid.jms.provider.amqp.FRAMES: RECV: Detach{handle=0,
> closed=true, error=Error{condition=amqp:link:detach-forced, description='The
> link
> 'G2:71211:qpid-jms:receiver:ID:51428778-b922-4612-9d58-1343134d388a:1:1:1:test-rcvr'
> is force detached by the broker due to errors occurred in consumer(link40).
> Detach origin: InnerMessageReceiver was closed.
> TrackingId:d1fcb94d000001bf000000285b117efe_G2_B3,
> SystemTracker:XXXXXXX:Queue:test-rcvr, Timestamp:6/1/2018 5:15:38 PM',
> info=null}}
> TRACE 2018-06-01 18:15:38,123 [AmqpProvider
> :(1):[amqps://XXXXXXX.servicebus.windows.net:-1]]
> org.apache.qpid.jms.provider.amqp.FRAMES: SENT: Detach{handle=0,
> closed=true, error=null}
>
>
> /////// Sample Code ///////
> package com.service.connector.example.test;
>
> import java.util.Hashtable;
>
> import javax.jms.Connection;
> import javax.jms.ConnectionFactory;
> import javax.jms.Destination;
> import javax.jms.ExceptionListener;
> import javax.jms.JMSException;
> import javax.jms.MessageConsumer;
> import javax.jms.MessageListener;
> import javax.jms.Session;
> import javax.naming.Context;
> import javax.naming.InitialContext;
> import javax.naming.NamingException;
>
> public class TestQpidRcvr implements MessageListener, ExceptionListener{
>
>         private static final String SBUS_NAME = "XXXXXXX";
>         private static final String USERNAME = "XXXXXXX";
>         private static final String PASSWORD = "XXXXXXX";
>         private static final String QPID_CONNECTION_FACTORY_CLASS =
> "org.apache.qpid.jms.jndi.JmsInitialContextFactory";
>
>         public static void main(String[] args) throws Exception {
>                 TestQpidRcvr test = new TestQpidRcvr();
>                 test.startListning();
>
>                 //Loop for not terminating the application
>                 int i = 0;
>                 while(i > 0){
>                         i++;
>                 }
>         }
>
>         /* Enable constructor, if you are running in any logger for server logs
>
>          public TestQpidRcvr() throws NamingException, JMSException {
>                 System.err.println("***** I am in ****");
>                 startListning();
>         }*/
>
>         private void startListning() throws NamingException, JMSException {
>                 Hashtable<String, String> hashtable = new Hashtable<>();
>                 hashtable.put("connectionfactory.SBCF", "failover:(amqps://"+ SBUS_NAME
> +".servicebus.windows.net?transport.tcpKeepAlive=true&amqp.traceFrames=true)?failover.reconnectDelay=2000&failover.maxReconnectAttempts=-1&failover.warnAfterReconnectAttempts=10&failover.startupMaxReconnectAttempts=3&jms.prefetchPolicy.all=1000&jms.forceAsyncSend=true");
>
>                 hashtable.put(Context.INITIAL_CONTEXT_FACTORY,
> QPID_CONNECTION_FACTORY_CLASS);
>
>                 Context context = new InitialContext(hashtable);
>                 ConnectionFactory connectionFactory = (ConnectionFactory)
> context.lookup("SBCF");
>
>                 Connection connection = connectionFactory.createConnection(USERNAME,
> PASSWORD);
>                 connection.setExceptionListener(this); // Settted ExceptionListener
>                 connection.start();
>
>                 Session session = connection.createSession(false,
> Session.CLIENT_ACKNOWLEDGE);
>
>                 System.out.println("createSession :: " + session);
>                 System.out.println("**** I am connected ****");
>
>                 Destination destination = session.createQueue("test-rcvr");
>                 System.out.println("**** Destination created ****");
>
>                 MessageConsumer consumer = session.createConsumer(destination);
>
>                 consumer.setMessageListener(this);
>
>                 System.out.println("**** Published successfully ****");
>         }
>
>
>         @Override
>         public void onMessage(javax.jms.Message message) {
>                 try {
>                         System.out.println("Received Message :: " + message.getJMSMessageID());
>                         message.acknowledge();
>                 } catch (JMSException e) {
>                         e.printStackTrace();
>                 }
>         }
>
>         @Override
>         public void onException(JMSException exception) {
>                 System.err.println("*** onException :: exception message :: ***" +
> exception.getMessage());
>                 exception.printStackTrace();
>
>         }
>
> }
>
>
>
>
> --
> Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by akabhishek1 <ma...@gmail.com>.
Hi Robbie,

Thank you so much for your analysis. I can confirm that there is some issue
in Qpid library. I am able to reproduced this issue. 

Please find below steps to reproduce this issue

1. Change value of "SBUS_NAME, USERNAME, PASSWORD" in below class
2. Run the below classe
3. Send one message on queue to verify the listener is working fine. If
running fine then
4. Delete the Queue from ServiceBus - this will enforce to detach the link. 

If you delete the queue then we can see AMQP detach error but not error from
exceptionListener.
We can see that, there are no issues pop up in "onException()" operation. if
issue does not pop up then we can't re-register listener. Please find below
error log.

Please suggest your opinion and correct me if i am doing any mistake.

Error Log

TRACE 2018-06-01 18:15:38,123 [AmqpProvider
:(1):[amqps://XXXXXXX.servicebus.windows.net:-1]]
org.apache.qpid.jms.provider.amqp.FRAMES: RECV: Detach{handle=0,
closed=true, error=Error{condition=amqp:link:detach-forced, description='The
link
'G2:71211:qpid-jms:receiver:ID:51428778-b922-4612-9d58-1343134d388a:1:1:1:test-rcvr'
is force detached by the broker due to errors occurred in consumer(link40).
Detach origin: InnerMessageReceiver was closed.
TrackingId:d1fcb94d000001bf000000285b117efe_G2_B3,
SystemTracker:XXXXXXX:Queue:test-rcvr, Timestamp:6/1/2018 5:15:38 PM',
info=null}}
TRACE 2018-06-01 18:15:38,123 [AmqpProvider
:(1):[amqps://XXXXXXX.servicebus.windows.net:-1]]
org.apache.qpid.jms.provider.amqp.FRAMES: SENT: Detach{handle=0,
closed=true, error=null}


/////// Sample Code ///////
package com.service.connector.example.test;

import java.util.Hashtable;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.ExceptionListener;
import javax.jms.JMSException;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.Session;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class TestQpidRcvr implements MessageListener, ExceptionListener{
	
	private static final String SBUS_NAME = "XXXXXXX";
	private static final String USERNAME = "XXXXXXX";
	private static final String PASSWORD = "XXXXXXX";
	private static final String QPID_CONNECTION_FACTORY_CLASS =
"org.apache.qpid.jms.jndi.JmsInitialContextFactory";

	public static void main(String[] args) throws Exception {
		TestQpidRcvr test = new TestQpidRcvr();
		test.startListning();
		
		//Loop for not terminating the application
		int i = 0;
		while(i > 0){
			i++;
		}
	}
	
	/* Enable constructor, if you are running in any logger for server logs 
	 
	 public TestQpidRcvr() throws NamingException, JMSException {
		System.err.println("***** I am in ****");
		startListning();
	}*/

	private void startListning() throws NamingException, JMSException {
		Hashtable<String, String> hashtable = new Hashtable<>();
		hashtable.put("connectionfactory.SBCF", "failover:(amqps://"+ SBUS_NAME
+".servicebus.windows.net?transport.tcpKeepAlive=true&amqp.traceFrames=true)?failover.reconnectDelay=2000&failover.maxReconnectAttempts=-1&failover.warnAfterReconnectAttempts=10&failover.startupMaxReconnectAttempts=3&jms.prefetchPolicy.all=1000&jms.forceAsyncSend=true");
		
		hashtable.put(Context.INITIAL_CONTEXT_FACTORY,
QPID_CONNECTION_FACTORY_CLASS);

		Context context = new InitialContext(hashtable);
		ConnectionFactory connectionFactory = (ConnectionFactory)
context.lookup("SBCF");
		
		Connection connection = connectionFactory.createConnection(USERNAME,
PASSWORD);
		connection.setExceptionListener(this); // Settted ExceptionListener
		connection.start();
		
		Session session = connection.createSession(false,
Session.CLIENT_ACKNOWLEDGE);
		
		System.out.println("createSession :: " + session);
		System.out.println("**** I am connected ****");
		
		Destination destination = session.createQueue("test-rcvr");
		System.out.println("**** Destination created ****");
		
		MessageConsumer consumer = session.createConsumer(destination);
		
		consumer.setMessageListener(this);
		
		System.out.println("**** Published successfully ****");
	}
	

	@Override
	public void onMessage(javax.jms.Message message) {
		try {
			System.out.println("Received Message :: " + message.getJMSMessageID());
			message.acknowledge();
		} catch (JMSException e) {
			e.printStackTrace();
		}
	}

	@Override
	public void onException(JMSException exception) {
		System.err.println("*** onException :: exception message :: ***" +
exception.getMessage());
		exception.printStackTrace();
		
	}
	
}




--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by Robbie Gemmell <ro...@gmail.com>.
The logs suggest the server closed all the links, sessions, and
finally the connection they were on. No error details were given. At
least the latter will cause the client to emit an error through its
ExceptionListener if you arent using the built in failover, which I
doubt you are with Mule.

Shortly after that, a new connection was created, but no producers or
consumers established. There is then a constant repeating stream of
this showing the server killing your connections for not doing
anything for 60 seconds, e.g:
2018-05-31 04:53:23,741 [AmqpProvider
:(2401):[amqps://XXXXXXXXX.servicebus.windows.net:-1]] DEBUG
proton.trace - IN: CH[0] :
Close{error=Error{condition=amqp:connection:forced, description='The
connection was inactive for more than the allowed 60000 milliseconds
and is closed by container 'LinkTracker'.
TrackingId:dafbd1781851427888c571526ae1e88c_G15,
SystemTracker:gateway5, Timestamp:5/31/2018 4:53:23 AM', info=null}}

Robbie

On 31 May 2018 at 12:23, akabhishek1 <ma...@gmail.com> wrote:
> HI Robbie,
>
> I am again having issue for Receiver(Listener). Listener stop receiving
> message.
>
> I started the application on Friday "2018-05-25 16:43:10,078" and keep
> application idle running for 2.5 days. After 2.5 days in idle state, i did
> testing on morning "2018-05-29 09:05:47,853". Listner was working fine on
> "2018-05-29".
>
> I kept application idle again for 2 days(i have not restarted the
> application on 29-May). So application is running from "25-May".
>
> I started testing today morning, and i found that Receiver is not working.
> After looking on log, i found that there is detach timeout at "2018-05-31
> 04:52:03,018".
>
> Last Receive - 2018-05-29 08:54:50,028
> Detach TimeOut - 2018-05-31 04:52:03,018
>
> Same Settings -  i have 4 consumer with separate Session and every consumer
> has one Listner.
>
> Please find logs at below location.
> https://github.com/abhikt48/servicebus/blob/master/ErrorLog-For-Qpid-Team.zip
>
>
> Could you please suggest your opinion about issues, how can we handle this?
> I am assuming ServiceBus broker detach the link.
>
> I have not received any error from qpid-jms-client level, so i can't handle
> the error also. Am i missing anything? Please suggest.
>
> Regards,
> Abhishek Kumar
>
>
>
> --
> Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by akabhishek1 <ma...@gmail.com>.
HI Robbie,

I am again having issue for Receiver(Listener). Listener stop receiving
message. 

I started the application on Friday "2018-05-25 16:43:10,078" and keep 
application idle running for 2.5 days. After 2.5 days in idle state, i did
testing on morning "2018-05-29 09:05:47,853". Listner was working fine on
"2018-05-29".

I kept application idle again for 2 days(i have not restarted the
application on 29-May). So application is running from "25-May". 

I started testing today morning, and i found that Receiver is not working.
After looking on log, i found that there is detach timeout at "2018-05-31
04:52:03,018". 

Last Receive - 2018-05-29 08:54:50,028
Detach TimeOut - 2018-05-31 04:52:03,018

Same Settings -  i have 4 consumer with separate Session and every consumer
has one Listner.

Please find logs at below location. 
https://github.com/abhikt48/servicebus/blob/master/ErrorLog-For-Qpid-Team.zip


Could you please suggest your opinion about issues, how can we handle this? 
I am assuming ServiceBus broker detach the link. 

I have not received any error from qpid-jms-client level, so i can't handle
the error also. Am i missing anything? Please suggest. 

Regards,
Abhishek Kumar



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by akabhishek1 <ma...@gmail.com>.
Hi Robbie,

Thanks a lot for all help and quick reply. I am going to handle in catch
block and re create producer for JMS IllegalStateException.

Have a nice day !! :)

Regards,
Abhishek Kumar



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by Robbie Gemmell <ro...@gmail.com>.
If I am reading your mail correctly, this sounds like its working as it should.

Either the async send method returns normally because it sent the
message, and you are then notified of the result asynchronously via
the CompletionListener (which may be success or failure depending on
if the message was successfully accepted by the server), or the async
send call fails and throws immediately because it didnt get as far as
actually sending the message (e.g because the producer was closed
before it was able to). If the producer was closed before you try to
send, which is what you are most likely to see in this scenario where
its closed because you didnt use it, the send call itself will throw.

Robbie

On 31 May 2018 at 17:06, akabhishek1 <ma...@gmail.com> wrote:
> Hi Robbie And Team,
>
> After your suggetion for handling exception for Producer in Catch Block and
> create again once Producer closed. I implemented this scenario. I can get
> exception with the use of CompletionListener only. So everytime i need to
> supply CompletionHandler for handling exception.
>
> For successful scenario - I am getting callback in
> SendCompletionHandler-->onCompletion method which is perfect.
> For Failed Scenario -- I am getting exception on catch block() of dispatch
> operation. But i am not getting callback on
> SendCompletionHandler-->onException ? Please find below code snippet.
>
> I have doubt on this, Why i am not getting callback on
> "SendCompletionHandler-->onException" ?
> Could you please suggest, why i am not getting callback on "onException"
> operation or implementation is working perfectly.
>
>
> //////// Code
>
>         //Global var
>         SendCompletionHandler sendCompletionHandler = new SendCompletionHandler();
>
>         public void dispatch(){
>                 try {
>                         producer.send(message, sendCompletionHandler);
>                 } catch (IllegalStateException illegalStateException) { // *** Getting
> Exception Callback here ***
>                         System.err.println("*** illegalStateException.getMessage() ***" +
> illegalStateException.getMessage());
>
>                         if (illegalStateException.getMessage().contains("The MessageProducer is
> closed")) {
>                                 // Reset Producer due to Idle TimeOut after 10m
>                                 producer = createProducer(session, endpoint);
>                                 producer.send(message, sendCompletionHandler));
>                         }else{
>                                 throw illegalStateException;
>                         }
>                 }
>         }
>
>         class SendCompletionHandler implements CompletionListener {
>
>                 @Override
>                 public void onCompletion(Message message) {
>                         logger.info("Completed JMSMessageID :: " + message.getJMSMessageID());
>                 }
>
>                 @Override
>                 public void onException(Message message, Exception exception) {
>                         try {
>                                 logger.error("Failed message JMSMessageID :: " +
> message.getJMSMessageID());
>                         } catch (JMSException e) {
>                                 e.printStackTrace();
>                         }
>
>                 }
>
>         }
>
>         Regards,
>         Abhishek Kumar
>
>
>
> --
> Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by akabhishek1 <ma...@gmail.com>.
Hi Robbie And Team,

After your suggetion for handling exception for Producer in Catch Block and
create again once Producer closed. I implemented this scenario. I can get
exception with the use of CompletionListener only. So everytime i need to
supply CompletionHandler for handling exception. 

For successful scenario - I am getting callback in
SendCompletionHandler-->onCompletion method which is perfect. 
For Failed Scenario -- I am getting exception on catch block() of dispatch
operation. But i am not getting callback on
SendCompletionHandler-->onException ? Please find below code snippet. 

I have doubt on this, Why i am not getting callback on
"SendCompletionHandler-->onException" ? 
Could you please suggest, why i am not getting callback on "onException"
operation or implementation is working perfectly. 


//////// Code 

	//Global var
	SendCompletionHandler sendCompletionHandler = new SendCompletionHandler();
	
	public void dispatch(){
		try {
			producer.send(message, sendCompletionHandler);
		} catch (IllegalStateException illegalStateException) { // *** Getting
Exception Callback here ***
			System.err.println("*** illegalStateException.getMessage() ***" +
illegalStateException.getMessage());

			if (illegalStateException.getMessage().contains("The MessageProducer is
closed")) {
				// Reset Producer due to Idle TimeOut after 10m
				producer = createProducer(session, endpoint);
				producer.send(message, sendCompletionHandler));
			}else{
				throw illegalStateException;
			}
		} 
	}
	
	class SendCompletionHandler implements CompletionListener {

		@Override
		public void onCompletion(Message message) {
			logger.info("Completed JMSMessageID :: " + message.getJMSMessageID());
		}

		@Override
		public void onException(Message message, Exception exception) {
			try {
				logger.error("Failed message JMSMessageID :: " +
message.getJMSMessageID());
			} catch (JMSException e) {
				e.printStackTrace();
			}

		}

	}
	
	Regards,
	Abhishek Kumar



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by Robbie Gemmell <ro...@gmail.com>.
You can't, its deep in the internals of the client and not exposed for
outside use (nor will it be).

On 30 May 2018 at 12:45, akabhishek1 <ma...@gmail.com> wrote:
> Hi Robbie and Team,
>
> I was doing to reseacrh to find out solution for MessageProducer Status.
>
> At this moment i am creating MessageProducer via below code.
> MessageProducer producer = session.createProducer(destination);
>
> After doing research, i got to know internally AmqpFixedProducer invoking
> for Send operation. And the good thing is that, AmqpFixedProducer has both
> operation "isClosed and isOpen".
> This will solve my problem. But the main problem is, how can i access
> AmqpFixedProducer object.?
>
> I tried to access via casting (with below code snippet) but that throwing
> Casting exception. Could you please suggest, how can i access
> AmqpFixedProducer object?
>
> AmqpFixedProducer -- extends --> AmqpProducer -- extends -->
> AmqpAbstractResource -- available methods --> isClosed and isOpen
>
> AmqpFixedProducer amqpProducer = (AmqpFixedProducer) producer;  //
>  "Getting java.lang.ClassCastException:
> org.springframework.jms.connection.CachedMessageProducer cannot be cast to
> org.apache.qpid.jms.provider.amqp.AmqpFixedProducer "
>
> amqpProducer
> .isClosed();
>
> amqpProducer
> .isOpen();
>
>
> Regards,
> Abhishek Kumar
>
>
>
> --
> Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by akabhishek1 <ma...@gmail.com>.
Hi Robbie and Team,

I was doing to reseacrh to find out solution for MessageProducer Status.

At this moment i am creating MessageProducer via below code.
MessageProducer producer = session.createProducer(destination);

After doing research, i got to know internally AmqpFixedProducer invoking
for Send operation. And the good thing is that, AmqpFixedProducer has both
operation "isClosed and isOpen". 
This will solve my problem. But the main problem is, how can i access
AmqpFixedProducer object.?

I tried to access via casting (with below code snippet) but that throwing
Casting exception. Could you please suggest, how can i access
AmqpFixedProducer object?

AmqpFixedProducer -- extends --> AmqpProducer -- extends -->
AmqpAbstractResource -- available methods --> isClosed and isOpen

AmqpFixedProducer amqpProducer = (AmqpFixedProducer) producer;  //
 "Getting java.lang.ClassCastException:
org.springframework.jms.connection.CachedMessageProducer cannot be cast to
org.apache.qpid.jms.provider.amqp.AmqpFixedProducer "

amqpProducer
.isClosed();

amqpProducer
.isOpen();


Regards,
Abhishek Kumar



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by Gordon Sim <gs...@redhat.com>.
On 30/05/18 12:42, Robbie Gemmell wrote:
> The client has an notification system for use in its tests, which can
> be used to listen for such events as they occur. Using it would tie
> application code to the client impl, entirely at odds with using the
> vendor neutral JMS API, and the listener implementation is also
> subject to change, so for both those reasons I wouldnt really
> recommend an application using it.

Understood. Catching and handling the exception (e.g. by closing and 
recreating the producer) is probably fine.

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by Robbie Gemmell <ro...@gmail.com>.
On 29 May 2018 at 21:00, Gordon Sim <gs...@redhat.com> wrote:
> On 29/05/18 20:24, Rob Godfrey wrote:
>>
>> On Tue, 29 May 2018 at 19:45, akabhishek1
>> <ma...@gmail.com>
>> wrote:
>>
>>> HI Robbie,
>>>
>>> Thanks a lot for details. I am able to reproduce this issue with your
>>> finding, i am facing same idle timeOut issue for every 10m.
>>>
>>> As MessageProducer have no internal operation which will tell us that
>>> MessageProducer is active or not. DO we have any library or facility
>>> available which will refresh MessageProducer in every 10m for idle
>>> scenario?
>>>
>>
>> Since the "idling" after 10 minutes is a ServiceBus specific "feature"
>> then
>> I would not expect any client library (except perhaps for those written by
>> Microsoft) to handle this scenario.
>
>
> The problem with the JMS API specifically though, is that there is no way to
> be notified that a producer has been closed or even to test whether it has
> been closed...
>

There is no explicit way, but methods on the producer throw a JMS ISE
if used when it is closed, there are plenty of getters.

>>> If not available then we have to write some custom logic to handle this
>>> scenario.
>>>
>>
>> Yes - I think the best option here is for you to write your own custom
>> logic here.  You could, for instance, write a wrapper around
>> MessageProducer that keeps track of the last time a message was sent and
>> if
>> that time was > 10 minutes ago could close the wrapped MessageProducer and
>> create a new one.
>
>
> Does the send() method throw a recognisable error if the underlying producer
> link has been detached?
>
> Your solution sounds like a good one for the case in question. More
> generally though, JMS users would probably need a way to handle links closed
> for less predictable reasons.
>

The client has an notification system for use in its tests, which can
be used to listen for such events as they occur. Using it would tie
application code to the client impl, entirely at odds with using the
vendor neutral JMS API, and the listener implementation is also
subject to change, so for both those reasons I wouldnt really
recommend an application using it.

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by Abhishek Kumar <ab...@gmail.com>.
Hi Gordon,

Yes correct, AFAIK there is no way to get notifications for Closing Of
Message Producer. 

Mostly send() method throws "javax.jms.IllegalStateException: The
MessageProducer is closed". 
Sometime I haven't received above error statement. So this is very
complicated situation. 

I think, I have to go ahead with Rob suggestion.

Regards,
abhishek kumar



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by Gordon Sim <gs...@redhat.com>.
On 29/05/18 20:24, Rob Godfrey wrote:
> On Tue, 29 May 2018 at 19:45, akabhishek1 <ma...@gmail.com>
> wrote:
> 
>> HI Robbie,
>>
>> Thanks a lot for details. I am able to reproduce this issue with your
>> finding, i am facing same idle timeOut issue for every 10m.
>>
>> As MessageProducer have no internal operation which will tell us that
>> MessageProducer is active or not. DO we have any library or facility
>> available which will refresh MessageProducer in every 10m for idle
>> scenario?
>>
> 
> Since the "idling" after 10 minutes is a ServiceBus specific "feature" then
> I would not expect any client library (except perhaps for those written by
> Microsoft) to handle this scenario.

The problem with the JMS API specifically though, is that there is no 
way to be notified that a producer has been closed or even to test 
whether it has been closed...

>> If not available then we have to write some custom logic to handle this
>> scenario.
>>
> 
> Yes - I think the best option here is for you to write your own custom
> logic here.  You could, for instance, write a wrapper around
> MessageProducer that keeps track of the last time a message was sent and if
> that time was > 10 minutes ago could close the wrapped MessageProducer and
> create a new one.

Does the send() method throw a recognisable error if the underlying 
producer link has been detached?

Your solution sounds like a good one for the case in question. More 
generally though, JMS users would probably need a way to handle links 
closed for less predictable reasons.

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by Rob Godfrey <ro...@gmail.com>.
On Tue, 29 May 2018 at 19:45, akabhishek1 <ma...@gmail.com>
wrote:

> HI Robbie,
>
> Thanks a lot for details. I am able to reproduce this issue with your
> finding, i am facing same idle timeOut issue for every 10m.
>
> As MessageProducer have no internal operation which will tell us that
> MessageProducer is active or not. DO we have any library or facility
> available which will refresh MessageProducer in every 10m for idle
> scenario?
>

Since the "idling" after 10 minutes is a ServiceBus specific "feature" then
I would not expect any client library (except perhaps for those written by
Microsoft) to handle this scenario.

>
> If not available then we have to write some custom logic to handle this
> scenario.
>

Yes - I think the best option here is for you to write your own custom
logic here.  You could, for instance, write a wrapper around
MessageProducer that keeps track of the last time a message was sent and if
that time was > 10 minutes ago could close the wrapped MessageProducer and
create a new one.

-- Rob


> Please suggest your opinion !!
>
> Regards,
> Abhishek Kumar
>
>
>
>
>
> --
> Sent from:
> http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>
>

Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by akabhishek1 <ma...@gmail.com>.
HI Robbie,

Thanks a lot for details. I am able to reproduce this issue with your
finding, i am facing same idle timeOut issue for every 10m.

As MessageProducer have no internal operation which will tell us that
MessageProducer is active or not. DO we have any library or facility
available which will refresh MessageProducer in every 10m for idle scenario?

If not available then we have to write some custom logic to handle this
scenario. 

Please suggest your opinion !!

Regards,
Abhishek Kumar

  



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by akabhishek1 <ma...@gmail.com>.
Hi Robbie and Team,

Can you please suggest, how can we monitor/track closed event of the AMQP
object? 

Can i receive every time below error whenever MessageProducer is closed ?
“javax.jms.IllegalStateException: The MessageProducer is closed”

Please suggest your opinion.

Regards,
Abhishek Kumar





--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by Robbie Gemmell <ro...@gmail.com>.
The logs show a collection of messages (1 per sender) like this:

2018-05-25 17:02:56,115 [AmqpProvider
:(1):[amqps://XXXXXXXXX.servicebus.windows.net:-1]] TRACE
org.apache.qpid.jms.provider.amqp.FRAMES - RECV: Detach{handle=0,
closed=true, error=Error{condition=amqp:link:detach-forced,
description='The link
'G15:49790:qpid-jms:sender:ID:2fa7bbe4-956e-4ff9-a788-00282e634a31:1:14:1:test-bus'
is force detached by the broker due to errors occurred in
publisher(link6868). Detach origin:
AmqpMessagePublisher.IdleTimerExpired: Idle timeout: 00:10:00.
TrackingId:0f8673cb000004c900001ad45b083f60_G15_B59,
SystemTracker:XXXXXXXXX:Queue:test-bus, Timestamp:5/25/2018 5:02:56
PM', info=null}}

Which to me indicates that Service Bus closed the producers because
they didnt send anything for 10 minutes. That being the case, it seems
youll have to either ensure your producers remain active, or refresh
them over time if they dont.

On 29 May 2018 at 16:39, akabhishek1 <ma...@gmail.com> wrote:
> Hi Robbie,
>
> Thank you so much for your quick reply.  Yes correct, your assumption is
> right, "1 listener for each consumer as a consumer can only have 1 listener.
> "
>
> I uploaded complete log files at below location. Could you please take a
> look and suggest why Producer stop sending message? I am so sorry, log is
> quite big but i uploaded complete so i don't miss anything.
>
> https://github.com/abhikt48/servicebus/blob/master/qpid-servicebus.zip
>
> We are really worried about this situation. Could you please also suggest,
> is there anyway to check Message Producer is open or not??  So if producer
> is close then i can open producer again.
>
> Regards,
> Abhishek Kumar
>
>
>
>
>
>
> --
> Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by akabhishek1 <ma...@gmail.com>.
Hi Robbie,

Thank you so much for your quick reply.  Yes correct, your assumption is
right, "1 listener for each consumer as a consumer can only have 1 listener.
"

I uploaded complete log files at below location. Could you please take a
look and suggest why Producer stop sending message? I am so sorry, log is
quite big but i uploaded complete so i don't miss anything.

https://github.com/abhikt48/servicebus/blob/master/qpid-servicebus.zip

We are really worried about this situation. Could you please also suggest,
is there anyway to check Message Producer is open or not??  So if producer
is close then i can open producer again.

Regards,
Abhishek Kumar






--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by Robbie Gemmell <ro...@gmail.com>.
On 29 May 2018 at 12:52, akabhishek1 <ma...@gmail.com> wrote:
> Hi Robbie,
>
> I did testing with -
>
> SETTINGS:
> 1. Single javax.jms.Connection
> 2. With the use of above Connection object created --> 4 Session
>     --> and created 4 Consumer for each Session --> 4 Listner for each
> consumer

Again, I assume you mean 1 listener for each consumer as a consumer
can only have 1 listener.

> 3. With the use of above Connection object created --> 17 Session
>     --> Using all 17 session for Message Creation

I dont see a reason for doing for this.

> 4. With the use of above Connection object created --> 17 Session
>     --> and created 17 Producer for each Session --> Using all producer for
> sending message
>
> So in my application, there are 38 Session Objects (4 for consumer, 17 for
> Producer, 17 for Message creation). (Is it a good practice to have these
> many sessions?)

You dont need to have a Session for message creation and then a
seperate session for a Producer to send the message.You typically use
the same session for both creating and sending a message via a
producer on the session. Sstrictly speaking you can use a message
created using any session, the only restriction is on threading; a
session is single threaded.

If you have 17 threads sending concurrently, then having 17 producers
on their own session seems fine. If you have 1 thread sending, then
you only really need one session from a JMS perspective, but you can
use several if you like. I do seem to recall mention of ServiceBus
itself not supporting muliple producer/consumer links per session in
the past.

For the consumers, the above sounds reasonable, but it mostly depends
what you want. You could have the 4 consumers on 1 session if you like
(and the server allows). If you are using a MessageListener then how
many sessions you'll want depends largely on the concurrency you want.
Each session has a single delivery thread for message listeners, so if
you created 4 consumers on it they would be serialized in their
delivery by the session. By creating more sessions, you get more
delivery threads.

>
>
> ISSUE:
> I started the application on Friday "2018-05-25 16:43:10,078" and keep
> application idle running for 2.5 days.
> After 2.5 days in idle state, i did testing today morning "2018-05-29
> 09:05:47,853". I found below result.
>
>         1. Consumer worked fine;
>         2. But, Producer failed to send messages after 2.5 days;
>         (Logs at below location) -
> https://github.com/abhikt48/servicebus/blob/master/ErrorLogs
>
> What is making the Producer to fail? Is there some setting I have to do?
>

The logs dont contain the exception message, but the stracktrace point
to it complaining that the producer was closed previously.

You clipped the earlier information so its not possible to say when,
but they will show it being detached at some point.

>
> ADDITIONAL QUESTIONS:
>         1. Can/should I create separate Message producer for every message and
> dispose it once message sent successfully?

This is to be avoided in general, as its extremely inefficient to
create and destroy a producer for each message, and so unless your
throughput is minimal it will impact performance noticeably.

>         OR
>         2. Can/should I have multiple message producer(more than 17) with single
> Session object? Is this a good practice?
>

Essentially answered above. You can have more than 1 producer on a
session if it suits your applications threading model (and assuming
the server actually supports it).

> Regards,
> Abhishek Kumar
>
>
>
> --
> Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
> For additional commands, e-mail: users-help@qpid.apache.org
>

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by akabhishek1 <ma...@gmail.com>.
Hi Robbie, 

I did testing with - 

SETTINGS:
1. Single javax.jms.Connection
2. With the use of above Connection object created --> 4 Session  
    --> and created 4 Consumer for each Session --> 4 Listner for each
consumer
3. With the use of above Connection object created --> 17 Session  
    --> Using all 17 session for Message Creation
4. With the use of above Connection object created --> 17 Session  
    --> and created 17 Producer for each Session --> Using all producer for
sending message
	
So in my application, there are 38 Session Objects (4 for consumer, 17 for
Producer, 17 for Message creation). (Is it a good practice to have these
many sessions?)


ISSUE:
I started the application on Friday "2018-05-25 16:43:10,078" and keep
application idle running for 2.5 days.
After 2.5 days in idle state, i did testing today morning "2018-05-29
09:05:47,853". I found below result.

	1. Consumer worked fine;
	2. But, Producer failed to send messages after 2.5 days;
	(Logs at below location) -
https://github.com/abhikt48/servicebus/blob/master/ErrorLogs
	
What is making the Producer to fail? Is there some setting I have to do?
	

ADDITIONAL QUESTIONS:
	1. Can/should I create separate Message producer for every message and
dispose it once message sent successfully?
	OR
	2. Can/should I have multiple message producer(more than 17) with single
Session object? Is this a good practice?
	
Regards,
Abhishek Kumar



--
Sent from: http://qpid.2158936.n2.nabble.com/Apache-Qpid-users-f2158936.html

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


Re: MessageListener stop listening message and producer stop sending message, -> "qpid-jms-client - 0.32.0"

Posted by Robbie Gemmell <ro...@gmail.com>.
There isnt really enough information here allowing to suggest
something. Perhaps try turning up some of the client logging
(http://qpid.apache.org/releases/qpid-jms-0.32.0/docs/index.html#logging)
to see if you can get a better idea whats happening.

That said, I dont really follow your described usage either. A
MessageConsumer can only have a single MessageListener, not 4, and you
specifically noted only having a single MessageConsumer. I'd mention
that the MessageProducer being on the same Session would be an illegal
threading usage if it is used outwith a MessageListener onMessage,
since setting a listener on a consumer dedicates the singled-threaded
Session to the listener thread once started.

On 24 May 2018 at 12:41, Abhishek Kumar
<ma...@gmail.com> wrote:
> Hi Team,
>
> We have created below object using "qpid-jms-client - 0.32.0" .
>
> 1. Single javax.jms.Connection
> 2. With the use of above Connection object created Single
> "javax.jms.Session"
> 3. With the use of above Session object created Single
> "javax.jms.MessageConsumer".
>      --> With the use of above MessageConsumer, create 4 MessageListener
> 4. With the use of above Session object created Single
> "javax.jms.MessageProducer"
>
>
> Connection URL - *failover:(amqps://XXXXXXXX.servicebus.windows.net
> <http://XXXXXXXX.servicebus.windows.net>)?failover.reconnectDelay=2000&failover.maxReconnectAttempts=-1&failover.warnAfterReconnectAttempts=10&failover.startupMaxReconnectAttempts=3&amqp.idleTimeout=30000&transport.connectTimeout=10&jms.prefetchPolicy.all=1000&jms.forceAsyncSend=true*
>
> BrokerName - Azure ServiceBus
>
> Everything was working fine when i deploy application. I tested
> application *after
> two days*, then we started facing issue. MessageListener stop listening
> message from queue, and producer stop sending message also. We have not
> received any error log also.
>
> We need to restart server for resolving this issue. This is very bad
> alternative.
>
> Could you please suggest your opinion to resolve this issue.
>
> Regards,
> Abhishek Kumar

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