I am new to EasyNetQ, and am stumped on an error I am seeing in the Rabbit Management console. After I run my code, everything processes fine that I can tell; but I have an exchange and queue that is getting created, and I can’t tell from where. My system consists of three separate projects: 1.) Common – this contains common classes used by the two processing projects 2.) Webservice – this receives orders from outside customers pushed into the webservice, which in turn simply places each uniqe order into a database log file of inbound transactions, as well as an inbound message queue via the publish method. 3.) Windows Service – this starts up two queue subscriptions: a. Inbound queue subscription - to monitor for new inbound items, process them, and place responses or external system requests onto the Outbound queue. b. Outbound queue subscription – takes the items, and pushes them out to other third party remote systems.

Now, let me show the issue, so you can keep it in mind as you read what I have set up. Before I run my modules, the overview shows:

The Exchanges listing shows:

And here is the Queues listing:

After I run a single transaction through my entire system, I have this in the overview (note the two hanging queued messages):

This in the Exchanges Listing (note the ErrorExchange_):

And this in the Queues listing (Note the EasyNetQ_Default_Error_Queue):

When I look into the Error Queue, and get messages, this is what I see: {"RoutingKey":"","Exchange":"FacilitySupplies","Exception":"System.AggregateException: One or more errors occurred. ---> EasyNetQ.EasyNetQException: No handler found for message type FSInbound\r\n at EasyNetQ.Consumer.HandlerCollection.GetHandler(Type messageType)\r\n at EasyNetQ.RabbitAdvancedBus.<>c__DisplayClass14.b__13(Byte[] body, MessageProperties properties, MessageReceivedInfo messageReceivedInfo)\r\n at EasyNetQ.RabbitAdvancedBus.<>c__DisplayClass19.b__18(Byte[] body, MessageProperties properties, MessageReceivedInfo receviedInfo)\r\n at EasyNetQ.Consumer.HandlerRunner.InvokeUserMessageHandler(ConsumerExecutionContext context)\r\n --- End of inner exception stack trace ---\r\n---> (Inner Exception #0) EasyNetQ.EasyNetQException: No handler found for message type FSInbound\r\n at EasyNetQ.Consumer.HandlerCollection.GetHandler(Type messageType)\r\n at EasyNetQ.RabbitAdvancedBus.<>c__DisplayClass14.b__13(Byte[] body, MessageProperties properties, MessageReceivedInfo messageReceivedInfo)\r\n at EasyNetQ.RabbitAdvancedBus.<>c__DisplayClass19.b__18(Byte[] body, MessageProperties properties, MessageReceivedInfo receviedInfo)\r\n at EasyNetQ.Consumer.HandlerRunner.InvokeUserMessageHandler(ConsumerExecutionContext context)<---\r\n

(note: I deleted the message to reduce the stuff to look through) Based on this error, I am not setting up my publish or subscription correctly; but my transaction does what it is supposed to do. It goes through the webservice, gets placed on the Inbound Queue, the webservice picks it up, processes it, places it on the Outbound Queue, and I can see it getting received by the remote system. BUT, I still have this error that I can’t explain and can’t get rid of!

In the COMMON module, I have the following two classes defined: [Queue("FSInbound", ExchangeName="FacilitySupplies")] public class FSInbound { public DateTime ReceivedDate { get; set; } public DateTime InterchangeDate { get; set; } public string SenderInterchangeQualifier { get; set; } public string SenderInterchangeID { get; set; } public string DestinationInterchangeQualifier { get; set; } public string DestinationInterchangeID { get; set; } public string InterchangeControlNumber { get; set; } public string TransactionSet { get; set; } public string EDI { get; set; } } [Queue("FSOutbound", ExchangeName = "FacilitySupplies")]

public class FSOutbound { public DateTime InterchangeDate { get; set; } public string SenderInterchangeQualifier { get; set; } public string SenderInterchangeID { get; set; } public string DestinationInterchangeQualifier { get; set; } public string DestinationInterchangeID { get; set; } public string InterchangeControlNumber { get; set; } public string TransactionSet { get; set; } public string EDI { get; set; } }

In the Web Service, I place the newly arrived transactions into the FSInbound queue as follows: url is set to: “host=localhost;username=xxxxxx;password=yyyyyy;requestedHeartbeat=0;prefetchcount=50;persistentMessages=true;timeout=0” private void InsertInboundQueue(FA997Data EDITran, string url) { try { using (var bus = RabbitHutch.CreateBus(url, x => x.Register())) { var msg = new EDICommon.FSInbound(); msg.DestinationInterchangeID = EDITran.DestinationInterchangeID; msg.DestinationInterchangeQualifier = EDITran.DestinationInterchangeQualifier; msg.EDI = EDITran.EDI; msg.InterchangeControlNumber = EDITran.InterchangeControlNumber; msg.InterchangeDate = EDITran.InterchangeDate; msg.ReceivedDate = DateTime.Now; msg.SenderInterchangeID = EDITran.SenderInterchangeID; msg.SenderInterchangeQualifier = EDITran.SenderInterchangeQualifier; msg.TransactionSet = EDITran.TSData[0].TransactionSet; bus.Publish(msg); } } catch (Exception ex) { string msg = ex.Message; } }

Finally, in the Windows Service, I use the same URL string as above, and: Define the following at the top of my windows service class: // Get all the EDI Handlers private DataTable EDIHandlers = null; private IDisposable cancelInbound = null; private ManualResetEvent inboundResetEvent; private IDisposable cancelOutbound = null; private ManualResetEvent outboundResetEvent; private private private private

string CloudAmqpUrl; IBus _bus; IBus _busOutbound; CancellationTokenSource _cancellationTokenSource;

private CancellationToken CancellationToken { get { return _cancellationTokenSource.Token; } } And have these methods:

public EDIService() { InitializeComponent(); } protected override void OnStart(string[] args) { // Create a new cancellation token source _cancellationTokenSource = new CancellationTokenSource(); // Get a list of all the EDI handlers EDIHandlers = GetEDIHandlers(); // Get the CloudAmpqp url to use for the messsage queue processing ControlValues cv = new ControlValues(); CloudAmqpUrl = cv.Read(connectionString, "CloudAmqpUrl"); _bus = RabbitHutch.CreateBus(CloudAmqpUrl, x => x.Register()); _busOutbound = RabbitHutch.CreateBus(CloudAmqpUrl, x => x.Register()); // Subscribe to the inbound message queue inboundResetEvent = new ManualResetEvent(true); cancelInbound = SubscribeInbound(inboundResetEvent); // Subscribe to the outbound message queue outboundResetEvent = new ManualResetEvent(true); cancelOutbound = SubscribeOutbound(outboundResetEvent); } private ISubscriptionResult SubscribeInbound(ManualResetEvent inboundResetEvent) { return _bus.Subscribe(string.Empty, msg => Task.Factory.StartNew(() => InboundHandler(inboundResetEvent, msg))); } private ISubscriptionResult SubscribeOutbound(ManualResetEvent outboundResetEvent) { return _busOutbound.Subscribe(string.Empty, msg => Task.Factory.StartNew(() => OutboundHandler(outboundResetEvent, msg))); } private void InboundHandler(ManualResetEvent billingConsumerResetEvent, FSInbound msg) { if (CancellationToken.IsCancellationRequested) { inboundResetEvent.Set(); Thread.Sleep(System.Threading.Timeout.Infinite); } else { inboundResetEvent.Reset(); try { // Create a new inbound object (this is a class in the webservice) Inbound ib = new Inbound(); // Assign the necessary items on the inbound object ib.EDIHandlers = EDIHandlers; ib.Process(msg, ref _busOutbound); } finally { inboundResetEvent.Set(); } }

} private void OutboundHandler(ManualResetEvent billingConsumerResetEvent, FSOutbound msg) { if (CancellationToken.IsCancellationRequested) { outboundResetEvent.Set(); Thread.Sleep(System.Threading.Timeout.Infinite); } else { outboundResetEvent.Reset(); try { // Create a new outbound object Outbound ob = new Outbound(); // Call the routine to process the outbound message ob.Process(msg); } finally { outboundResetEvent.Set(); } } } protected override void OnStop() { _cancellationTokenSource.Cancel(); Console.WriteLine("disposing inbound consumer"); if (!inboundResetEvent.WaitOne(TimeSpan.FromSeconds(15))) { Console.WriteLine("Inbound consumer hasn't finished on time and was forcefully disposed. The message was probably NACKed."); } else { inboundResetEvent.Reset(); inboundResetEvent.WaitOne(TimeSpan.FromSeconds(5)); } cancelInbound.Dispose(); Console.WriteLine("disposing outbound consumer"); if (!outboundResetEvent.WaitOne(TimeSpan.FromSeconds(15))) { Console.WriteLine("Outbound consumer hasn't finished on time and was forcefully disposed. The message was probably NACKed."); } else { outboundResetEvent.Reset(); outboundResetEvent.WaitOne(TimeSpan.FromSeconds(5)); } cancelOutbound.Dispose(); // Dispose of the bus _bus.Dispose(); _busOutbound.Dispose(); Console.WriteLine("All consumers stopped."); }

In my Inbound class in here, I write to the outbound queue as follows:

public bool InsertOutboundQueue(ref IBus bus, DateTime InterchangeDate, string SenderInterchangeQualifier, string SenderInterchangeID, string DestinationInterchangeQualifier, string DestinationInterchangeID, string InterchangeControlNumber, string TransactionSet, string EDI) { bool rtnVal = false; ControlValues cv = new ControlValues(); string url = cv.Read(ConnectionString, "CloudAmqpUrl"); try { var msg = new EDICommon.FSOutbound(); msg.DestinationInterchangeID = DestinationInterchangeID; msg.DestinationInterchangeQualifier = DestinationInterchangeQualifier; msg.EDI = EDI; msg.InterchangeControlNumber = InterchangeControlNumber; msg.InterchangeDate = InterchangeDate; msg.SenderInterchangeID = SenderInterchangeID; msg.SenderInterchangeQualifier = SenderInterchangeQualifier; msg.TransactionSet = TransactionSet; bus.Publish(msg); // set the return value to true rtnVal = true; } catch (Exception ex) { string msg = ex.Message; } return rtnVal; }

I am new to EasyNetQ, and am stumped on an error I ... -

private void InsertInboundQueue(FA997Data EDITran, string url). { try. { using (var bus = RabbitHutch.CreateBus(url, x => x.Register

661KB Sizes 1 Downloads 167 Views

Recommend Documents

I am new to EasyNetQ, and am stumped on an error I ... -
private void InsertInboundQueue(FA997Data EDITran, string url). { try. { using (var bus = RabbitHutch.CreateBus(url, x => x.Register

i am bruce lee i am bruce lee.pdf - Drive
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. i am bruce lee i ...

I Am Yours
what defines us—what are the implications of the directional tone found in words like “toward you, I”? • In addition to the word “yours” having a directional tone, ...

I Am Yours
Taking it Home. • One commentator wrote of Psalm 119 that it “speaks the language of one ravished with moral beauty, to which there is only one fitting ...

Why I am an Atheist
and that there was a certain amount of vanity that actuated my disbelief. Well, the .... ideas like ours do not throw bombs on their own innocent people. One fine ...

Why I am an Atheist
they have had with me, that it was too much on my part to deny the existence of God ... It may be, it is only legitimate pride in our cult and does not amount to.

i think i think, therefore i think i am - UFRGS
Page 1 ... Merely thinking you think isn't good enough to generate knowledge you exist ... your own thoughts that give you a reason to believe you have them?

I Am Joaquin.pdf
and ruled, and taught, with gun and flame and mystic power. I worked, I sweated, I bled, ... living my nine lives fully. I was the Espinoza ... Of men who rule by deception and hypocrisy. I stand here looking back,. And now I see the present,. And st

i am malala.pdf
Malala Yousafzai. with Christina Lamb. Weidenfeld & Nicolson. LONDON. Page 3 of 195. i am malala.pdf. i am malala.pdf. Open. Extract. Open with. Sign In.

I Am Joaquin.pdf
Of men who rule by deception and hypocrisy. I stand here looking back,. And now I see the present,. And still I am a campesino,. Page 3 of 8. I Am Joaquin.pdf.

Am I Blue.pdf
Page 1 of 15. Association Loi 1901-0691041776. Siège Social ;: 24, Cours Aristide Briand - 69300 CALUIRE - PORT. 06.03.51.52.36. Site internet ...

I Am Thankful.pdf
I am thankful for school,. where I learn ABC. I am thankful for love. from my family. Page 3 of 4. I Am Thankful.pdf. I Am Thankful.pdf. Open. Extract. Open with.

I am Kwakkoli.pdf
Loading… Whoops! There was a problem loading more pages. Whoops! There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. I am Kwakkoli.pdf. I am Kwakkoli.pdf. Ope

pdf-1442\i-am-me-i-am-free-the-robots-guide-to ...
pdf-1442\i-am-me-i-am-free-the-robots-guide-to-freedom-by-david-icke.pdf. pdf-1442\i-am-me-i-am-free-the-robots-guide-to-freedom-by-david-icke.pdf. Open.