You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by TrainTime <zz...@gmail.com> on 2012/08/27 21:48:06 UTC

C# Consumers Disconnecting

            I've been trying to figure out this problem I've been having with
apache NMS for at least a week now, so I decided maybe I would try to post
here and see if anyone has experienced similar issues.  In my situation, we
have about 5-7 producers all producing to one topic, and then we have one
consumer consuming data from the same topic.  However, this singular
consumer will suddenly disconnect from the broker with no indication to me
(that i've been able to find) and stop receiving anything, the only way to
tell is by checking the broker and seeing that the topic has no consumers. I
have been searching around these forums for a solution and here's a few
things I tried that didn't seem to make any difference:

         1. Set ?wireFormat.maxInactivityDuration=0 on my openWire transport
connector
         2. Set my IConnection and ISession to be auto acknowledge
         3. Changed the memory limit of topics to 100mb from 1 mb
         4. Call IMessage.Acknowledge after receiving a message
         5. Changed IConnection and ISession to be persistent object along
with the consumer

      I'm not sure what else at this point I have to try.  I'm using
activeMQ 5.6 SNAPSHOT which runs as a service, Apache.NMS 1.5.1.2739, and
Apache.NMS.ActiveMQ 1.5.6.2746.  Also one last thing, here's how I'm
creating my consumer in the C# code:

 //setup jms
                        IConnectionFactory factory = new
ConnectionFactory(_connectURI);

                        _connection = factory.CreateConnection();
                        _connection.AcknowledgementMode =
AcknowledgementMode.AutoAcknowledge;
                        _connection.ConnectionInterruptedListener +=
ConnectionLost;

                        _connection.Start();
                        _session =
_connection.CreateSession(AcknowledgementMode.AutoAcknowledge);

                        _consumer = _session.CreateConsumer(new
Apache.NMS.ActiveMQ.Commands.ActiveMQTopic(_topicName));
                        _consumer.Listener += ProcessItem;

                        _status.Status = ConnectorStatus.Running;
                        _status.Details = "JMS Connector is running";


And here's what the consumer listener function looks like:

public void ProcessItem(IMessage message)
        {
            message.Acknowledge();
             /*  code */
         }


I also tried looking at Apache logging a bit, but it didn't seem to output
anything useful.  I think I need to change what its logging, is ERROR the
correct syntax for the sl4j logging properties file?  Thanks in advance for
any help anyone can offer, this has been driving me nuts ><






--
View this message in context: http://activemq.2283324.n4.nabble.com/C-Consumers-Disconnecting-tp4655632.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: C# Consumers Disconnecting

Posted by Jim Gomes <e....@gmail.com>.
Yes, it does reconnect to the same broker.  I recommend using it to ensure
reliability against network outages.

I also noticed that you are running against an ActiveMQ 5.6 SNAPSHOT.  Is
there a reason you haven't upgraded to the shipping version?  If the
problem is due to a problem on the server side, someone else may not be
able to replicate it.

Also it shouldn't be necessary to call Acknowledge() in the message handler
if you have AutoAcknowledge set.


On Tue, Aug 28, 2012 at 7:58 AM, TrainTime <zz...@gmail.com> wrote:

>   I was not using the failover protocol, though I just tried it and it did
> not appear to fix anything. I don't think it really applies in my situation
> because there's only one broker, not many. Unless if there's just one
> broker
> does it just try to reconnect to the one over and over?
>   As for pattern, I haven't really noticed one, which has made this all the
> more frustrating.  The only thing that seems to be constant, is we have a
> gap in data (ie. |--data----|..............[----data---]).  The gap in my
> testing file is probably about a minute, maybe 2 at most, and it usually
> disconnects at some random time in that duration.  But I've also seen it
> successfully stay connected the whole time.  I'm trying to
> enableStatusMonitoring on the transport connector now and hopefully get
> some
> more useful information.
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/C-Consumers-Disconnecting-tp4655632p4655721.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Re: C# Consumers Disconnecting

Posted by TrainTime <zz...@gmail.com>.
  I was not using the failover protocol, though I just tried it and it did
not appear to fix anything. I don't think it really applies in my situation
because there's only one broker, not many. Unless if there's just one broker
does it just try to reconnect to the one over and over?
  As for pattern, I haven't really noticed one, which has made this all the
more frustrating.  The only thing that seems to be constant, is we have a
gap in data (ie. |--data----|..............[----data---]).  The gap in my
testing file is probably about a minute, maybe 2 at most, and it usually
disconnects at some random time in that duration.  But I've also seen it
successfully stay connected the whole time.  I'm trying to
enableStatusMonitoring on the transport connector now and hopefully get some
more useful information.



--
View this message in context: http://activemq.2283324.n4.nabble.com/C-Consumers-Disconnecting-tp4655632p4655721.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: C# Consumers Disconnecting

Posted by Jim Gomes <e....@gmail.com>.
One thing you didn't mention that could be helpful is whether you are using
the failover protocol.  I would think that any network interruption would
be handled by the failover layer and automatically reconnect the consumer.

Other than that, have you noticed any pattern to the connection, such as it
disconnects after the same duration, or after the same number of messages
consumed, etc.

On Mon, Aug 27, 2012 at 12:48 PM, TrainTime <zz...@gmail.com> wrote:

>             I've been trying to figure out this problem I've been having
> with
> apache NMS for at least a week now, so I decided maybe I would try to post
> here and see if anyone has experienced similar issues.  In my situation, we
> have about 5-7 producers all producing to one topic, and then we have one
> consumer consuming data from the same topic.  However, this singular
> consumer will suddenly disconnect from the broker with no indication to me
> (that i've been able to find) and stop receiving anything, the only way to
> tell is by checking the broker and seeing that the topic has no consumers.
> I
> have been searching around these forums for a solution and here's a few
> things I tried that didn't seem to make any difference:
>
>          1. Set ?wireFormat.maxInactivityDuration=0 on my openWire
> transport
> connector
>          2. Set my IConnection and ISession to be auto acknowledge
>          3. Changed the memory limit of topics to 100mb from 1 mb
>          4. Call IMessage.Acknowledge after receiving a message
>          5. Changed IConnection and ISession to be persistent object along
> with the consumer
>
>       I'm not sure what else at this point I have to try.  I'm using
> activeMQ 5.6 SNAPSHOT which runs as a service, Apache.NMS 1.5.1.2739, and
> Apache.NMS.ActiveMQ 1.5.6.2746.  Also one last thing, here's how I'm
> creating my consumer in the C# code:
>
>  //setup jms
>                         IConnectionFactory factory = new
> ConnectionFactory(_connectURI);
>
>                         _connection = factory.CreateConnection();
>                         _connection.AcknowledgementMode =
> AcknowledgementMode.AutoAcknowledge;
>                         _connection.ConnectionInterruptedListener +=
> ConnectionLost;
>
>                         _connection.Start();
>                         _session =
> _connection.CreateSession(AcknowledgementMode.AutoAcknowledge);
>
>                         _consumer = _session.CreateConsumer(new
> Apache.NMS.ActiveMQ.Commands.ActiveMQTopic(_topicName));
>                         _consumer.Listener += ProcessItem;
>
>                         _status.Status = ConnectorStatus.Running;
>                         _status.Details = "JMS Connector is running";
>
>
> And here's what the consumer listener function looks like:
>
> public void ProcessItem(IMessage message)
>         {
>             message.Acknowledge();
>              /*  code */
>          }
>
>
> I also tried looking at Apache logging a bit, but it didn't seem to output
> anything useful.  I think I need to change what its logging, is ERROR the
> correct syntax for the sl4j logging properties file?  Thanks in advance for
> any help anyone can offer, this has been driving me nuts ><
>
>
>
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/C-Consumers-Disconnecting-tp4655632.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>