Neuron ESB User Network

The Service Bus for the Connected Business

Hi,

 

I’d like to know how Transaction based messaging is done in Neuron.

 

I see that for a transactional queue (MSMQ based), the messages are going to the corresponding transactional message queue (say PanToDeals_Transactional). However, when control comes to my OnRecieve handler for this queue, the message has already been pulled out of the queue (confirmed this by debugging and checking the transactional queue at the very first line of the OnReceive handler).

 

I would like to keep the message in the queue and take them off explicitly…in other words….messages should not be automatically removed by Neuron – that control should lie with my code.

 

Any thoughts on how that can be achieved?

 

Thanks,

Bhasker

Tags: MSMQ, Neuron, transaction

Views: 952

Reply to This

Replies to This Discussion

This behavior is by design.  Neuron ships an event based pub/sub system.  unlike other pub/sub systems, we allow the architect to determine the underlying protocol/transport that drives the pub/sub system at the Topic level.  Hence once you create a topic, you can choose to either use TCP, Peer, Named Pipes, MSMQ or, in Neuron 3.0, AMQP.  There are pros/cons to using specific transports.  Some are obviously in memory....so no latency due to transactions or durability or other components required to be installed (i.e. TCP,Peer and Named Pipes).  Others can run headless when using the Party API...i.e. when I say headless I mean the Neuron ESB service could be down..yet you could still publish and receive messages. Peer supports this.,..as well as MSMQ when the direct property for the network transport is set to True.  Other transports offer optional durability and transaction support....Both MSMQ and AMQP are transports in that category.

Our goal with the Topic based pub/sub system is to abstract the network transport details from the User for the most part.  In other words...they are internal implementation details that you don't have to worry about.  At the end of the days, you create Topics with the characteristics and quality of service attributes you need, and under hood, the Neuron Parties (i.e. Publishers/Subscribers) communicate with Topics.  Topics control where a message is routed (i.e. what party or parties receive it) and how they receive it.

The underlying Party object manages the communication details of "how" to talk to a Topic...regardless of the properties or protocol that its configured for. Specifically so that the user doesn't have to know.

When you publish a message using our Party api (i.e. Publisher.Send()), in most cases you are sending a message to the Neuron ESB publishing service that represents the Topic.  The publishing service's job is to route the message to appropriate set of subscribers using the protocol/network configuration specified for that specific topic.  Subscribers are event based.  So when you hook into the OnReceive event, you're basically saying...I'm alive and I'm subscribing to messages so provide them as soon as they appear.  

If for example, you configured a Topic that the Subscriber is "subscribed" to with MSMQ as the network transport and you've set the transactions and durability properties to true, you will get reliable, guaranteed, end to end delivery of the message all the way through the OnReceive event.  Under the hood, we have physical queues that represent each party that can publish or subscribe to that topic.

if you want to abort receipt of the message, you can do one of three things; 1.) raise an exception in the OnReceive handler code....this will effectively rollback the transaction and roll back the message to the underlying physical msmq queue we use to represent the party.  2.) set the MessageEventArgs.Cancel argument to True, which will also effectively abort the transaction and roll back the message to the underlying physical msmq queue we use to represent the party. 3.) rollback the ambient transaction like so:

Transaction tx = System.Transactions.Transaction.Current;
if (tx == null) tx.Rollback();

Now...even if you abort the transaction and roll it back, the Party will just try to pick it up again.  How many retries are determined by the retry property values that you configure for the MSMQ network properties at the Topic level, specifically the "Max Retry Cycles", "Receive Retry Count" and "Retry Cycle Delay".

if you want to just handle one message at a time, you can set the network properties of the transport for batch size = 1 (default I think is 100) and max concurrent calls to 1 (default I think is 32).  then in your OnReceive handler code, manage the receipt of the message and then just block processing until you need to handle the next message

Hope this helps

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