MassTransit Request Response sample - rabbitmq

I'm learning about MassTransit, so I downloaded the sample they have however it doesn't seem to be working for me, I'm getting the following error when I try to start the service:
An exception occurred
MassTransit.RabbitMqTransport.RabbitMqConnectionException: Connect failed: igor#localhost:5672/test ---> RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable ---> RabbitMQ.Client.Exceptions.OperationInterruptedException: The AMQP operation was interrupted: AMQP close-reason, initiated by Peer, code=530, text="NOT_ALLOWED - vhost test not found", classId=10, methodId=40, cause=
at RabbitMQ.Client.Impl.SimpleBlockingRpcContinuation.GetReply(TimeSpan timeout)
When I try to use other examples using older versions of MassTransit they are working fine.

The sample uses a RMQ URI, which includes the test virtual host. Since you have not created it, your code fails and it actually tells you exactly this - virtual host test is not found.
Here is the app.config from that sample:
<appSettings>
<add key="RabbitMQHost" value="rabbitmq://localhost/test"/>
<add key="ServiceQueueName" value="request_service"/>
</appSettings>
Hence that the client uses the same URI, so both of them will fail starting.

Related

Is there a way to dynamically define and register new Dgraphs in Endeca

As far as my knowledge of Endeca goes, any time you want to add a new dgraph definition in your Endeca configuration, you have to run initializeServices.sh to set the updated configuration on EAC.
I was wondering if there is any way I can do that without running initalizeServices.sh (since it does a lot more than just update the list of Dgraph registered in EAC, and I want to prevent that).
I found the command ./runcommand.sh --update-definition allows you to do configuration changes to a Dgraph, which has already been registered with EAC, but if I add a new dgraph in config and run the command it fails with below error:
[11.17.16 16:00:07] INFO: Setting definition for host 'MDEXLiveHost2'.
[11.17.16 16:00:07] SEVERE: Caught an exception while checking provisioning
Caused by com.endeca.soleng.eac.toolkit.exception.EacCommunicationException
com.endeca.soleng.eac.toolkit.host.Host setDefinition - Caught exception while setting host definition.
Caused by com.endeca.eac.client.ProvisioningFault
sun.reflect.NativeConstructorAccessorImpl newInstance0 - null
I can't find any detailed logs of this error being generated anywhere in PlatformServices logs to further debug.
I could, however see in request log that /eac/ProvisioningService gave a HTTP code of 500, which leads me to believe that the script is trying to find current configuration of MDEXLiveHost2 and is unable to find it.
EDITED TO ADD Configuration for:
New host:
<host id="MDEXLiveHost2" hostName="${mdexLive.host2}" port="${mdexLive.eac.port}" useSsl="false" />
New Dgraph:
<dgraph id="DgraphLive2" host-id="MDEXLiveHost2" port="${dgraphLive1.port}"
post-startup-script="LiveDgraphPostStartup">
<properties>
<property name="restartGroup" value="A" />
<property name="updateGroup" value="a" />
<property name="DgraphContentGroup" value="Live" />
</properties>
<log-dir>./logs/dgraphs/DgraphLive</log-dir>
<input-dir>./data/dgraphs/DgraphLive/dgraph_input</input-dir>
<update-dir>./data/dgraphs/DgraphLive/dgraph_input/updates</update-dir>
</dgraph>
EDITED TO ADD errors after manually adding host using eaccmd.sh
Host definition file:
<host host-id="MDEXLiveHost2" host-name="172.18.0.7" port="9999" useSsl="false"/>
The host is added successfully (validated via describe-app)
$./eaccmd.sh describe-app --app myapp | grep MDEXLiveHost2
<host host-name="172.18.0.7" port="9999" host-id="MDEXLiveHost2" useSsl="false">
But, running any command I get this error:
[11.18.16 11:00:58] INFO: Updating provisioning for host 'MDEXLiveHost2'.
[11.18.16 11:00:58] INFO: Host name of host 'MDEXLiveHost2' has changed from 172.18.0.7 to 172.18.0.7 . Components on this host will be re-provisioned.
[11.18.16 11:00:58] INFO: Updating definition for host 'MDEXLiveHost2'.
[11.18.16 11:00:58] SEVERE: Caught an exception while checking provisioning.
Caused by com.endeca.soleng.eac.toolkit.exception.EacCommunicationException
com.endeca.soleng.eac.toolkit.host.Host updateEacDefinition - Caught exception while updating host definition.
Caused by com.endeca.eac.client.ProvisioningFault
sun.reflect.NativeConstructorAccessorImpl newInstance0 - null
If only this error could be made more verbose, that might give some help.
You do not have to run initializeServices.sh for every configuration change you make. When you execute other scripts in the control folder, they first check if there are any configuration changes and apply these changes.
As far as the error is concerned, I suspect you either didn't specify the MDEXLiveHost2 in your LiveDGraphCluster.xml or the host that you did specify is not reachable. Verify your configuration.
Lastly your approach to dynamically add more DGraphs into the cluster is not standard practice. When you configure your environment you should do a load test using ENEPerf to simulate the load and then create as many DGraphs and hosts as required. If you are adding more hosts and DGraphs dynamically, you also need to ensure that you add them, dynamically, into your load balancer configuration as well.
My first guess was that maybe the mdex host 2 didn't have Platform services/Mdex installed and Platform services running but it may be that the port you specified is incorrect.
<host host-id="MDEXLiveHost2" host-name="172.18.0.7" port="9999" useSsl="false"/>
Is your eac port 9999 and not 8888 (OOB value)? If it is 9999 on your ITL server, you want to make sure that it is also set to 9999 on your new Dgraph server.

signalR client cannnot reconnect

I have a website web.glidertracking.co.uk which seems to work well but after a short time it stops working.
In Firefox on the console I get the message
Firefox can't establish a connection to the server at
ws://web.glidertracking.co.uk/signalr/reconnect?transport=webSockets&messageId=d-F12111CE-A%2C2F76%7CE%2C0%7CF%2C1%7CG%2C0&clientProtocol=1.4&connectionToken=9rtmojkUsiTz1k1hGHAHq5NDVy%2Fs96KyNyrvR1YDeHsqqraESwr4ky2waZfL4MRhFykwSxLEsdKMGQkKiH6Pkd7AZ%2BF1CqjuyN0xKcgxWb9PldJXF0ILOOw4JEE7A7wZ&connectionData=%5B%7B%22name%22%3A%22aprshub%22%7D%5D&tid=8.
jquery.signalR-2.1.1.js:1622:36 This is repeated several times as the
page tries to reconnect.
In Chrome the same thing happens with the message
WebSocket connection to
'ws://web.glidertracking.co.uk/signalr/reconnect?transport=webSockets&messageId=d-50D0B86A-A%2C42E5%7CH%2C0%7CI%2C1%7CJ%2C0&clientProtocol=1.4&connectionToken=088xfYgsm2yPs1Ig2VxFqLBuwlLoKtDPWl9FKEMr3%2Bt%2F%2F56DEnBqXBQiVoG93tfRPTxprdtPtKBGnKCAyDZfpy3Z1pw1pRiz6kxAGapXXoAhUDmeCQePBXVcdltFrfgh&connectionData=%5B%7B%22name%22%3A%22aprshub%22%7D%5D&tid=0'
failed: Error during WebSocket handshake: Unexpected response code:
400
Can anyone Help me.
What is going wrong?
I would be happy to provide the code for the whole site but there is a lot of code!
Had similar issue, SignalR connection was ok, but re-connect fail with Unexpected response code: 404, or (after some manipulations with web.config) with Unexpected response code: 400.
Solved after checking & changing limitations for maxQueryStringLength, maxUrlLength, maxQueryString. in the Web.Config:
<system.web>
<httpRuntime maxQueryStringLength="32768" maxUrlLength="65536"/>
<security>
<requestFiltering>
<requestLimits maxQueryString="32768"/>
</requestFiltering>
</security>
<system.web/>
Values "32768" & "65536" just for example, check and test your own.
P.S.In our case, we had a long query string, because we send all the hub's names to the server thinking that it is necessary for reconnect. But after all we saw, that it was no nessesary.

BizTalk WCF Timeout Issue

I have a orchestration in BizTalk which is collect to data via web services from SAP.
My process is as below.
We have a SOAP service on receive port and when we get an request from SOAP we transform it to SAP RFC File format and send it to SAP. When we try to get a response from SAP we get an error when response data is big. If response message size is so big our service get a timeout error. Otherwise there is a no problem if the message size is not big.
I tried to increase timeout duration on BizTalk management console but still fails. Whatever I did, the timeout duration is always in 1 minutes.
After Adding below XML config tags to machine.config file I get an error as below figure.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config
<configuration>
<system.transactions>
<machineSettings maxTimeout="00:20:00" />
</system.transactions>
</configuration>
Below image is SAP Send Port
SAP Send Port Details
In the detail as you can see my time out duration about 10 hour but in SOAP UI I get an timeout error after 1 minute.
Below image is Receive Port
Also you can find biztalk event viewer error as below.
A response message sent to adapter "SOAP" on receive port "WebPort_SAP/MusteriFaturaT/ABC_SAP_Fatura_T_FaturaOrch_InvoiceReceivePort" with URI "/SAP/MusteriFaturaT/ABC_SAP_Fatura_T_FaturaOrch_InvoiceReceivePort.asmx" is suspended.
Error details: The original request has timed out. The response arrived after the timeout interval and it cannot be delivered to the client.
And SOAPUI response screen is blank as below
On WCF Custom send port, change the value of time out (close, open, send, receive) to increase timeout. See the link for more details
You can also use SOAPUI tool to test your web service outside BizTalk to see the response time and response size.
Problem is about SOAP UI timeout issue. When i change the timeout property of SOAP our timeout duration was increase to 110 second. 110 second is default soap timeout duration. For fix this issue you have to add below config options to web.config file.
<system.web>
<httpRuntime executionTimeout="43200" />
</system.web>
Also you have to add below configs to client app.config file.
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="IBRAHIM_SAP_Fatura_T_FaturaOrch_InvoiceReceivePortSoap" maxReceivedMessageSize="2147483647" receiveTimeout="03:00:00"
sendTimeout="02:00:00" transferMode="Streamed"/>
</basicHttpBinding>
</bindings>
</system.serviceModel>
UPDATE:
Now we have the error it is indicating that it is the client that timed out rather than BizTalk, in this case SoapUI. As per the answer from this question SoapUI: ConnectException: Connection timed out:
Default socket timeout is set to 60000 milliseconds. You can change it:
File -> Preferences -> HTTP Settings -> Socket Timeout
When you are connecting with another client, you will also have to check/set the timeouts in that.
ORIGINAL POST:
If you are using BizTalk 10 or above check the response timeout on the host is set to a value greater than a minute.
I had an issue with Timeouts as well an this was one setting I changed (in this case to the maximum).
You can set up a specific Host for large transactions where the Response timeout in minutes is changed and only those ports that need it use it.
However even after I changed that to the maximum value I encountered a timeout after 15 minutes.
For that I had to disable Use Transaction, only do this if you still encounter issues and you are retrieving data and not inserting/changing data.
The above images are from my blog post about the issue BizTalk Server Negative Acknowledgement issues in SAP and WCF.
As to setting the system.transaction setting in the config, that is rather dangerous to do as it will affect everything, not just that port.
You have to increase your timeout in the machine.config file
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config
<configuration>
<system.transactions>
<machineSettings maxTimeout="00:20:00" />
</system.transactions>
</configuration>
You must also set the property allowExeDefinition to "MachineToApplication" from "MachineOnly"

How do I correctly set up NServiceBus to use remote error queue?

I am trying to set up NServiceBus to use a remote error queue to ease the management of checking for errors. When I do this, I get the following error when NServiceBus.Host.exe starts up:
2010-03-25 07:59:50,103 [1] ERROR NServiceBus.Utils.MsmqUtilities [(null)] <(null)> - Could not create queue error#C0NSERVICEBUS or check its existence. Processing will still continue.
System.Messaging.MessageQueueException: Invalid queue path name.
at System.Messaging.MessageQueue.ResolveFormatNameFromQueuePath(String queuePath, Boolean throwException)
at System.Messaging.MessageQueue.Exists(String path)
at NServiceBus.Utils.MsmqUtilities.CreateQueueIfNecessary(String queueName)
Here are my config settings for NServiceBus:
<!-- in order to configure remote endpoints use the format: "queue#machine"
input queue must be on the same machine as the process feeding off of it.
error queue can (and often should) be on a different machine. -->
<MsmqTransportConfig InputQueue="ClipboardSubscriberInputQueue" ErrorQueue="error#C0NSERVICEBUS" NumberOfWorkerThreads="1" MaxRetries="5"/>
<UnicastBusConfig>
<MessageEndpointMappings>
<add Messages="PatientFirst.Messaging" Endpoint="ClipboardPublisherInputQueue#C0NSERVICEBUS"/>
</MessageEndpointMappings>
</UnicastBusConfig>
Is this normal expected behavior, if not what am I doing wrong?
This is normal behavior.
NServiceBus tries to automatically create queues for you when it can. When it can't, it's lower level components may complain, but as you saw in the logs, the higher level components continue working.

Port being used by another application in WCF

I am facing the problem with WCF self hosting application while trying to run with the following configuration:
<system.serviceModel>
<services>
<service name="statisticsCollectingService">
<endpoint address="net.tcp://localhost:8200/RadioStatistics/"
binding="netTcpBinding"
contract="RadioStatistics.Services.IStatisticsCollectingService" />
<endpoint address="http://localhost:8100/RadioStatistics/"
binding="basicHttpBinding"
contract="RadioStatistics.Services.IStatisticsCollectingService" />
</service>
<service name="biDataExportService">
<endpoint address="net.tcp://localhost:8001/RadioStatistics/"
binding="netTcpBinding"
contract="RadioStatistics.Services.IBIDataExportService" />
</service>
</services>
</system.serviceModel>
The exception occurs as follows:
System.Configuration.ConfigurationErrorsException: Error creating context 'spring.root': The process cannot access the file because it is being used by another process ---> Spring.Objects.Factory.ObjectCreationException: Error creating object with name 'statisticsCollectingServiceHost' defined in 'config [C:\TTL\zer_rel_12_1_main_TTL_C1077\TTL\CommonTools\RadioStatistics\bin\Debug\RadioStatistics.ServerApp.vshost.exe.Config#spring/objects] line 4' : Initialization of object failed : HTTP could not register URL http://+:8000/RadioStatistics/services/ because TCP port 8000 is being used by another application. ---> System.ServiceModel.AddressAlreadyInUseException: HTTP could not register URL http://+:8000/RadioStatistics/services/ because TCP port 8000 is being used by another application. ---> System.Net.HttpListenerException: The process cannot access the file because it is being used by another process
at System.Net.HttpListener.AddAll()
at System.Net.HttpListener.Start()
at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
--- End of inner exception stack trace ---
at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
at System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelListener.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open()
at Spring.ServiceModel.Activation.ServiceHostFactoryObject.AfterPropertiesSet() in l:\projects\spring-net\trunk\src\Spring\Spring.Services\ServiceModel\Activation\ServiceHostFactoryObject.cs:line 176
at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.InvokeInitMethods(Object target, String name, IConfigurableObjectDefinition definition) in l:\projects\spring-net\trunk\src\Spring\Spring.Core\Objects\Factory\Support\AbstractAutowireCapableObjectFactory.cs:line 1264
at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.ConfigureObject(String name, RootObjectDefinition definition, IObjectWrapper wrapper) in l:\projects\spring-net\trunk\src\Spring\Spring.Core\Objects\Factory\Support\AbstractAutowireCapableObjectFactory.cs:line 1860
at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.InstantiateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching, Boolean suppressConfigure) in l:\projects\spring-net\trunk\src\Spring\Spring.Core\Objects\Factory\Support\AbstractAutowireCapableObjectFactory.cs:line 884
--- End of inner exception stack trace ---
at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.InstantiateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching, Boolean suppressConfigure) in l:\projects\spring-net\trunk\src\Spring\Spring.Core\Objects\Factory\Support\AbstractAutowireCapableObjectFactory.cs:line 901
at Spring.Objects.Factory.Support.AbstractObjectFactory.CreateAndCacheSingletonInstance(String objectName, RootObjectDefinition objectDefinition, Object[] arguments) in l:\projects\spring-net\trunk\src\Spring\Spring.Core\Objects\Factory\Support\AbstractObjectFactory.cs:line 2097
at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObjectInternal(String name, Type requiredType, Object[] arguments, Boolean suppressConfigure) in l:\projects\spring-net\trunk\src\Spring\Spring.Core\Objects\Factory\Support\AbstractObjectFactory.cs:li
Running a Windows XP SP3 was already trying to do the following:
httpcfg set urlacl /u http://+:8100/RadioStatistics/ /a "D:(A;;GX;;;BU)"
(with I guess all possible variants of general grants and/or users - like DU (for domain users?)
Also trying to add to the IP list
httpcfg set iplisten -i 0.0.0.0:8100
This was after I've found an event in the event log:
Unable to bind to the underlying
transport for 0.0.0.0:8100. The IP
Listen-Only list may contain a
reference to an interface which may
not exist on this machine. The data
field contains the error number.
The worst is that it was already working in the past (before I went on holidays few weeks ago). The machine seems unchanged to me as it was not being touched. But the error drives me crazy. The worst thing is that the error occurs regardless the choosen port.
Of cource it works absolutely fine after the basicHttpBinding is removed.
TIA
Roland
You may have something else listening on the same port. Try running
netstat -o -n -a
to get a list of all the processes and what they are listening for.
I believe this has to do with configuring the service in .NET 3.5 and then changing to .NET 4.0 - the service configuration defaults have changed radically, and now by default many endpoints are created. http://blogs.msdn.com/b/endpoint/archive/2009/06/30/service-configuration-improvements-in-net-4.aspx
#Roland, I know this is a very old post and I have seen you asking this on other sites as well. I have recently had this problem for a very long time. Eventually I have two ways of resolving this.
1) Though this is probably not the recommended way, get local admin permission on the account that runs the window service. This is why when people run VS as admin this problem goes away on their local machine because HTTP by default grants permission to local admin.
2) As you said, use httpcfg on xp/2003 server to configure the url and port number like you did; worth mentioning that "D:(A;;GX;;;LS)" is the correct SDDL that worked for me; I tried others but didn't work. Equally importantly, don't include the service name when configuring just use httpcfg set urlacl -u http://+:portnumber -a D:(A;;GX;;;LS)". And don't configure iplisten with httpcfg as this will most likely prevent IIS running on the server. The error you got from the event log: "Unable to bind to the underlying transport for 0.0.0.0:8100. The IP Listen-Only list may contain a reference to an interface which may not exist on this machine. The data field contains the error number" suggests that IIS is stopped. In fact if you do httpcfg query iplisten you should only see the default ipaddress 0.0.0.0. After configuring the url using httpcfg you need to restart http with net stop http and wait for everything to stop successfully. Then do net start http. If http couldn't stop properly you need to reboot the server after which IIS should be running (if you had deleted any invalid ipaddress). Then start your window service and check with netstat -an | findstr "0.0:yourportnumber" if there is a result then that means your window service is working now.
Just to add, I have followed the instructions on our first dev server and it didn't work initially because 1) I added iplisten and 2) I didn't restart http after configuring the url. 3) I didn't check to make sure iis was running properly.
Hope this helps somehow.
This problem is solved by right clicking on your Visual Studio application icon and selecting "Run as administrator".
Here's an excerpt from the Microsoft official documentation page:
The service must be run with administrator privileges. Because you opened Visual Studio with administrator privileges, when you run GettingStartedHost in Visual Studio, the application is run with administrator privileges as well. As an alternative, you can open a new command prompt as an administrator (select More > >Run as administrator from the shortcut menu) and run GettingStartedHost.exe within it.
https://learn.microsoft.com/en-us/dotnet/framework/wcf/how-to-host-and-run-a-basic-wcf-service
You may need to change the port number as well.