Neuron ESB User Network

The Service Bus for the Connected Business

Is anyone out there using SQL Server Message Broker as a source for messages flowing into Neuron?  And if so, did you write a custom adapter for it?  Or did you use the built-in SQL adapter with some other trigger mechanism?

 

 

Tags: Broker, SQL, Service

Views: 623

Reply to This

Replies to This Discussion

Hello Volox,
I believe we have one customer doing this today...and another looking into it. There are a few approaches you can take to use SQL Server Message Broker as a source of messages for Neuron....each one has pros and cons.
1. The first approach is to use the Activation feature of SQL Server's "Alter Queue" statement. This allows you to associate a “Target” stored procedure with a Sql Broker "Queue"....and hence it would execute each time a new message arrived in the queue. There are plenty of examples on line. Within this stored procedure, the message would be read from the queue and from there, a call would be made to a SQL CLR (extended) procedure. An extended procedure maps to a .NET assembly. To use it, you have to import your .NET assembly into Sql Server using the "CREATE ASSEMBLY" syntax like so:
CREATE ASSEMBLY [Neuron.ESb.Sample.SqlClr]
FROM N'C:\Neuron\SampleNeuronAPI\SqlClrAssembly\bin\Release\Neuron.ESb.Sample.SqlClr.dll'

If your .NET assembly references other assemblies, those assemblies will need to be imported first. There are a few "gotchas" though with this. Sql Server's support for .NET is not very good. WCF is not supported....and many namespaces are not. But you can get this to work if you keep to the basics in your custom .NET assembly....say like calling a service reference for an ASMX based service. In many cases, you'll probably have to use the option for Visual Studio to create a serialization assembly for your project and load that as well like so:
CREATE ASSEMBLY [Neuron.ESb.Sample.SqlClr.XmlSerializers]
FROM N'C:\Neuron\SampleNeuronAPI\SqlClrAssembly\bin\Release\Neuron.ESb.Sample.SqlClr.XmlSerializers.dll'
Once you import all the necessary .NET assemblies into Sql Server, you need to create the extended stored procedure which the “Target” procedure would call out to. You do this by using the CREATE PROCEDURE like in the sample below:
CREATE PROCEDURE spNeuronSendToBus (@url nvarchar(max), @message nvarchar(max), @action nvarchar(max))
AS
EXTERNAL NAME [Neuron.ESb.Sample.SqlClr].[Neuron.ESb.Sample.SqlClr.BusManager].SendToBus
If you decide to have the method within your .NET assembly call out to an ASMX service to do the work, just use WSDL.exe to generate a client proxy class from the wsdl of your asmx service. Using an ASMX service as an intermediate step allows you to either use our client API, or WCF against a neuron client connector (generic web service on ramp hosted by Neuron) to submit the messages to Neuron. Also, since you don’t have any constraints with what assemblies you can reference…you can pretty much do whatever you want within the ASMX service code. Also, if you need to change the way/logic in which you submit messages to Neuron, you only need to edit the ASMX service…you won’t need to re load your .NET assembly into Sql Server.
Alternatively, if you didn’t want to use an ASMX intermediate service to do the actual submitting of the message, you could just use System.Net.WebClient to submit the message to a Neuron client connector. This has the benefit of simplicity since there’s no intermediate ASMX web service you have to build….and there will not be a requirement to load a serialization assembly into Sql Server.
Either approach works fine.
2. The next approach…which I tend to think is easier, is to write a receive side Neuron adapter that sits and waits for messages to be submitted to the queue. It would use the same WAITFOR and RECEIVE and receive statement that you would have to use in the “Target” stored procedure in the first approach. This doesn’t poll…nor does it place a lock on the queue. So very efficient. I think there are still bugs with Sql Broker….so you’ll probably want to optimize by placing the statement that the adapter uses into a stored procedure.

In any case, I have working examples of all these….I do tend to like the latter the best. I’ll post all the source code hopefully in the next few weeks. If you need this earlier, just feel free and ping me at marty.wasznicky@neudesic.com
Will look forward to seeing the samples.

Is there any plan to add a built-in adapter for Nueron to connect with Service Broker? And maybe use the queue activiation events to launch message consumption (similar to the way the new External Activation does)?

For External Activation see... http://social.msdn.microsoft.com/Forums/en-US/sqlservicebroker/thre...
Hi Volox,

We currently have no plans to add a built in adapter to support it. We really don't see too many people at all using Sql Broker....so the demand just isn't there to justify it unfortunately.

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