Neuron ESB User Network

The Service Bus for the Connected Business

We have a Windows Service using .NET 4.5 publishing messages to the bus using Neuron 2.6 and it's taking about 1.5 seconds, which is way too long.

 

Every time we publish a message, we do this:

using (var publisher = new Publisher(subscriberConfiguration))

{

publisher.Connect();

retVal = publisher.Send(topic, message);

}

 

Our profiler identifies this as the slowest part of our code by far. This code is called by thousands of threads and must execute quickly. We are trying to think of ways to speed this up.

Is it safe to create a static Publisher, initialize and Connect just once at the start of our service, and just call Send() from all the threads as needed. Would this speed things up sufficiently, and is it safe to call the Send method from multiple threads at the same time?

Also, what happens if the connection drops for some reason, is there a way to detect and reconnect gracefully without loosing messages?

 

Thanks in advance,

 

Dan

Tags: Send, method

Views: 285

Reply to This

Replies to This Discussion

yes..that should work, just make sure you put locking in place and look catch the offline events...connect errors, etc.  you can catch the Send error....if you get disconnected...place a lock around everything and reconnect and send.  There's a sample project in the updated Neuron Fundamentals training doc

Thanks for the quick reply Marty,

 

Are you saying that we need to lock the call like this?

 

lock(publisher)

{

   while (true)

   {

      try {

         publisher.Send(...);

         return;

      }

      catch(...)

      {

         publisher.Connect();

      }

   }

}

 

Do we really need to lock the Send() method, or just the Connect method?

 

Also, where do we find the "Neuron Fundamentals training doc"? Is this available online or installed in the Neudesic directory (we have both 2.6 full version and the 3.0 beta installed).

 

Thanks again,

 

Dan

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