Neuron ESB User Network

The Service Bus for the Connected Business

Is there a way to tell if a Publisher is actually connected to the Neuron server?

Currently, we just try to send a test message to a test topic and check for exceptions. However, this might not be that efficient and we are hoping to find a better/faster way.

We know that we can attach to the OnOffline and OnOnline events but they are called for each topic and we are not sure if we can use this to test the actual server connection.

Please advise,

Thanks,

Dan

Tags: connection

Views: 304

Reply to This

Replies to This Discussion

Hi Dan,

if you are just testing, you can always use our test client.  Just open it, select the publisher object and hit connect.  you'll see the online events fire and each topic that it connects to will show up as green in the UI.

when connecting to a topic with a party, its actually a 2 step process.  First the party needs to connect to the bus (i.e. management/boostrap service) to get its latest configuration information.  If that's successful, it then needs to connect to each of its topics.  hence, you'll find that the online/offline events fire for each topic that the Party has a subscription to. 

if you are just using our API in code, the fundamentals tutorial has a good sample to show how to connect, catch and inspect errors and use the online and offline events:

http://support.neuronesb.com/downloads/NeuronFundamentals.zip  

sample code would look something like this:

// Create an instance of a publisher
using (Publisher publisher = new Publisher(PUBLISHER))
{
    publisher.OnOnline += new Channels.TopicEventHandler(publisher_OnOnline);

    // catch any exceptions that may occurr while connecting to each individual topic
    PartyConnectExceptions exceptions = publisher.Connect();
    if (exceptions != null && exceptions.Count > 0)
    {
        foreach (var e in exceptions.GetResults())
            Console.WriteLine(string.Format("An error occurred connecting '{0}' to Topic, '{1}'. {2}", publisher.Context.PartyId,                 e.Exception.Message, e.Topic));
    }
    else
    {

        // Send some XML. Body type is automatically set.  Lots of different Send methods
        publisher.SendXml(TOPIC, "<Test>dsfdsf</Test>");

    }
}

Hi Marty,

 

Thanks for the quick rely and the sample source code. However, I find that if neuron is down that the Connect method throws an exception so does not return. Actually, this is fine for my purposes because I can just catch the exception so my code looks like this:

 
public bool IsConnectionUp(string serviceAddress, string zone, string partyId)
{
 var subscriberConfiguration = new SubscriberConfiguration
 {
  ServiceAddress = serviceAddress,
  ServiceIdentity = "",
  SubscriberId = partyId,
  Zone = zone
 };
 try
 {
  using (var publisher = new Publisher(subscriberConfiguration))
  {
   var exceptions = publisher.Connect();
   if (exceptions != null && exceptions.Count > 0)
    return false;
   return true;
  }
 }
 catch(Exception)
 {
  return false;
 }
}

 

Does this look like it should cover most connectivity failures?

RSS

Neuron ESB Product Support Forums and Communities

Latest Activity

Anupama Nair posted a discussion

Marketo Adapter Invalid Token

Hi,We are using the Marketo adapter to push account updates to Marketo. It works well for some time then starts failing with Invalid Token unless restarted. Is there a configuration that can be done so it can auto refresh the token when required?Thanks!See More
Nov 6, 2023
Sayantini Basak posted a discussion

Maximum payload size(REST API) for requests interfacing to NeuronESB

I am new to Neuron ESB and in our current scenario,We need to process batch transactions comprising of ~1000 records and send them to Neuron ESB for further processing. I would like to understand what is the maximum size of payload that can be transferred using REST interface to Neuron ESB.See More
Jul 22, 2022
Profile IconRobert E Dunie and Sayantini Basak joined Neuron ESB User Network
Apr 28, 2022
Profile IconDayanand, Frederic C, Steffen Greve-Oksfeldt and 1 more joined Neuron ESB User Network
Mar 16, 2022
Profile IconCam Vong and Mitja Luznar joined Neuron ESB User Network
Jan 27, 2022
Profile IconWill Hitzges, Chad Parsons, michael larsen and 4 more joined Neuron ESB User Network
Jun 11, 2021
Anupama Nair posted a discussion

ODBC stored proc polling with temporary tables

We have set up an ODBC adapter to poll a stored proc.We found that if the stored proc has a temporary table defined the rows returned are always 0.Any idea why this would be and what we can do to get around it?See More
Dec 14, 2020
Prasanth Kharade is now a member of Neuron ESB User Network
Dec 30, 2019

Badge

Loading…

© 2024   Created by Neuron Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service