Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7563265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:37:20+00:00 2026-05-30T13:37:20+00:00

I’m having a hell of a time with some Apache NMS issues. Part of

  • 0

I’m having a hell of a time with some Apache NMS issues. Part of this may be my own lack of understanding of the platform.

In essence, I have an NMS STOMP client that I use to send and receive AMQ messages via STOMP. The API looks a bit like this:

internal sealed class NMSStompClient : IDisposable
{
    public bool IsConnected { get; }

    public void Connect(Uri uri, string userId, string password, TimeSpan timeout);

    public void Disconnect();

    public void Send(IDestination destination, IDestination replyDestination, long sessionId, int correlationId, byte[] messageBytes, TimeSpan timeout);

    public IDisposable Subscribe(IDestination destination, Action<IMessage> messageHandler, Action<IMessage, Exception> errorHandler);
}

I’m attempting to get my integration tests to pass consistently, but they always fail when I increase the amount of time that AMQ is down for (passes at 10 seconds, fails at 60). After excruciating amounts of debugging and tracing, I’ve found that the problem appears to stem from my IsConnected implementation (or, at least, this is part of the problem):

public bool IsConnected
{
    // connection is Apache.NMS.IConnection
    // session is Apache.NMS.Stomp.Session
    get { return this.connection != null && this.connection.IsStarted && this.session != null && this.session.Connection == this.connection; }
}

I arrived at this implementation through trial and error. I simply could not find a simple way to determine whether the connection was “up”. There is no property that I can find on either IConnection or Session that will tell me this.

I’m aware of the ConnectionInterruptedListener, ConnectionResumedListener, and ExceptionListener events, but the only one raised during my integration test is ExceptionListener. Moreover, I understand they aren’t raised at all when using failover, which I am in production.

Can anyone help me to reliably determine whether the connection is up or not? Or perhaps clear up any misunderstanding I may have?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:37:21+00:00Added an answer on May 30, 2026 at 1:37 pm

    The Apache.NMS.Stomp client does indeed have a failover transport that will call the interrupted and resumed methods however when using failover you don’t really need to care about those since the failover transport will deal with reconnecting things for you. When using a straight TCP connection you will only see the ExceptionListener invoked because from the point of view of the tcp transport, once its failed its failed, so an exception is appropriate.

    You can make the general case assumption that when your client gets a callback on its ExceptionListener listener that the connection state is failed and do whatever reconnect you need to, although if you use the failover transport it will be handled for you, so no work needed on your part.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
I'm having trouble keeping the paragraph square between the quote marks. In firefox the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.