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: 1154

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

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