Neuron ESB User Network

The Service Bus for the Connected Business

Sending messages to a Client Connector from an C# Console App

I have an issue with sending messages to a Client Connector from a C# test app. The main issue is that  i never receive a response from Neuron and the Connection Times out. I'm using the sample code from the Scatter-Gather Pattern sample included in the documentation 

If anybody has any hints on what i'm missing, it would be appreciated.

static class Utility
{

const string _propName = "NeuronServiceList";

const string _ns = "urn:xmlns:neuronesb-com:soapheaders";

const string _msg = @"
<Notification>
<Id>1234567890</Id>
<sObject xsi:type=""sf:Account"" xmlns:sf=""urn:sobject.enterprise.soap.sforce.com"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"">
<sf:Id>001Z0000002lOr4IAE</sf:Id>
<sf:BillingCity>New York</sf:BillingCity>
<sf:BillingCountry>United States</sf:BillingCountry>
</sObject>
</Notification>";

const string _neuronServiceList =
@"<services>
<service topic='SalesforceEvents.CreateAccount'
action='http://schema.neuron.sample/CreateAccount'>
</service>
</services>";

public static void PipelineByWebService()
{
XmlReader xmlReader = null;
Message reqMsg = null;

// Sending a request/response to a client connector
using (var chan = new ChannelFactory<IRequestChannel>(new BasicHttpBinding() , new EndpointAddress("http://localhost:55555/test")))
{
var proxy = chan.CreateChannel();

using (xmlReader = XmlReader.Create(new System.IO.MemoryStream( System.Text.Encoding.UTF8.GetBytes(_msg))))
{
using (reqMsg = Message.CreateMessage(chan.Endpoint.Binding.MessageVersion, "", xmlReader))
{
// add custom headers to define services for scatter gather pattern
MessageHeader header = MessageHeader.CreateHeader(_propName, _ns, _neuronServiceList);
reqMsg.Headers.Add(header);
Console.WriteLine(proxy.Request(reqMsg).ToString());
reqMsg.Close();
}
xmlReader.Close();
}
proxy.Close();
chan.Close();
}
}
}

Tags: Client, Connector

Views: 79

Reply to This

Replies to This Discussion

Hi John,

Have you checked the event log for the reported errors? 

Hi Marty,

 

I had a look in the Neuron ESB event log and Neuron_EventLogFailedWrites.txt and found the errors below. They tell me i got a timeout which is strange as this is internal to Neuron. So in effect 2 timeouts are occurring - one on my client caused by the timeout on Neuron.

I still don't know how to fix it though.

John

Event Log

    Event Info: Client connector failed to process a received message due to an exception

    Type: Client Connector
    Name: SalesforceServicePublications
    MessageId: f98deab6-40bc-4a42-bceb-c85c7237ed7c
    MessageTopic: SalesforceEvents
    MessageSourceId:
    Exception: Request timeout
    Method: ProcessMessage2Internal
    Stack: at Neuron.Esb.EsbService.ESBClientConnector.ProcessMessage2Internal(Message message)

And also this

    Event Info: A message has been saved to the audit failed database. Topic: SalesforceEvents, Party: , Id: f98deab6-40bc-4a42-bceb-c85c7237ed7c
    FailureDetail - Exception Type: System.ServiceModel.FaultException
    Exception Message: Request timeout
    Exception Trace: at Neuron.Esb.EsbService.ESBClientConnector.ProcessMessage2Internal(Message     message)
    FailureType - FaultException
    Exception:
    Method:
    Stack:

In the Neuron_EventLogFailedWrites.txt i found this

Method: SendMessage

Entry at 14/02/2012 16:06:57
Could not write message to the Neuron Esb event log. Reason: The source 'Neuron ESB Client Context' is not registered in log 'Neuron ESB'. (It is registered in log 'Application'.) " The Source and Log properties must be matched, or you may set Log to the empty string, and it will automatically be matched to the Source property.
Original message to be written to the event log. Message: Event Info: Exception Type: System.TimeoutException
Exception Message: Timeout occured while waiting for a reply to message d16cd839-cae2-48dc-b394-425ac8b20f28. Party - SalesforceService.Publisher. Topic - SalesforceEvents.AccountCreated
Exception Trace: at Neuron.Esb.Channels.RequestResponseCorrelationDataItem.Wait()
at Neuron.Esb.Party.SendMessage(ESBMessage message, Boolean duplicateMessage)
at Neuron.Esb.EsbService.ESBClientConnector.ProcessMessage2Internal(Message message)


Exception:

Method:

Stack:

Entry at 14/02/2012 16:06:57
Could not write message to the Neuron Esb event log. Reason: The source 'Neuron ESB Client Context' is not registered in log 'Neuron ESB'. (It is registered in log 'Application'.) " The Source and Log properties must be matched, or you may set Log to the empty string, and it will automatically be matched to the Source property.
Original message to be written to the event log. Message: Event Info: Exception Type: System.ServiceModel.FaultException
Exception Message: Request timeout
Exception Trace: at Neuron.Esb.EsbService.ESBClientConnector.ProcessMessage2Internal(Message message)


Exception:

Method:

Stack:

I came up with a work-around for this, but i'm sure there must be a better way. I had to introduce a new topic that used a pipleline to republish to my original topic and then called a cancel step. This had the result of issuing the response to the client and allowing the process to continue.

The down side of this is that i have to create and extra "proxy" topic and it's associated pub/subs that can also publish to the destination topic for each Client Connector.

I anybody finds a more suitable implementation, I'd love to hear about it.

Hi John,

How is your client connector configured.  Its has to match the configuration in the client code.

Kind regards,

Marty

Here are my Client Connector settings. As far as i can tell they match the code in my first post

General:

- Binding: BasicHttp

Binding

- Message Pattern : Request Reply

Max Message Size: 1000000

Transactions : None

Client Connector:

- Enabled : true

- Capture Custom Headers: false

URL: http://localhost:9001

RSS

Neuron ESB Product Support Forums and Communities

Latest Activity

Nick Novotny posted a discussion

Script to stop/restart service connectors

Is there a way to turn on and off service connectors through the neuron api?  Right now I need to go to Endpoint Health in Activity, and right click to stop and restart service connectors, I would like to have a script to do this.  Is this possible? Thanks,-Nick NSee More
May 11
Profile Iconsuresh datla and Mahboob joined Neuron ESB User Network
Apr 24
Nick Novotny posted a discussion

Msmq network transport error logging

We have multi-casting one way messaging through a remote msmq server using wcf services for our system. One day one of our many environments got a message to multicast…and didn’t send anything out.  We have a pipeline step to audit the incoming message, topic properties to move msmq messages to a dead letter queue after a specific amount of time, and a service policy to move messages to the failed neuron db table after a specific amount of time/retries (matching the msmq network properties to…See More
Apr 13
Stas Makutin posted a discussion

Load-balancing using Neuron

I want to implement following scenario using Neuron ESB:- get big list of working items from somewhere (let's say some database)- split this list to small "batches" of working items- send these batches each to particular instance of specific subscriber (Worker), so each that instance will process assigned batch in parallel with other instances- collect feedback (is processing complete/failed) + implement some fail-over mechanism (resend failed batches, monitor if batches weren't processed…See More
Apr 11
Profile IconStas Makutin, Bjorn Thomsen and Steve Harclerode joined Neuron ESB User Network
Apr 11
MH is now a member of Neuron ESB User Network
Mar 29
Profile IconCraig Muir and mehnaz joined Neuron ESB User Network
Mar 12
John Ryan posted a discussion

Trouble creating a net.msmq Client Connector

Has anyone successfully created a Client Connector using Net.msmq?I'm trying as many different configurations as i can to post a message to a Client Connector but i get the following error on my client app:"The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state."It looks as though my client connector endpoint is not binding to the WAS correctly.If anyone has any ideas, i'd love to hear them.Here are my Client…See More
Mar 6

Badge

Loading…

© 2012   Created by Neuron Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service