Error occured while trying to use Nservice bus - message-queue

I am new to NServcie bus and Im was trying to implement Publication and subscription of messages .This is the error I'm getting
Exception when starting endpoint, error has been logged. Reason: The destination queue 'mygateway' could not be found. You may have misconfigured the destination for this kind of message (NServiceBus.Unicast.Transport.CompletionMessage) in the MessageEndpointMappings of the UnicastBusConfig section in your configuration file.It may also be the case that the given queue just hasn't been created yet, or has been deleted.
This is the configuration used that i used in app config
<MsmqTransportConfig
InputQueue="publisherqueue"
ErrorQueue="error"
NumberOfWorkerThreads="1"
MaxRetries="5" />
<UnicastBusConfig
DistributorControlAddress=""
DistributorDataAddress=""
ForwardReceivedMessagesTo="">
<MessageEndpointMappings>
<add Messages="Messages"
Endpoint="mygateway" />
</MessageEndpointMappings>
</UnicastBusConfig>
<MsmqSubscriptionStorageConfig
Queue="GateWaySubscriptions" />
My question is why this "mygateway " queue is not automatically created ? Am i doing anything wrong ? Please help.
Thanks
Alex.

This app you are configuring for only "owns" (use that term loosely) the queues in MsmqTransportConfig, namely, "publisherqueue" and "error". These are the only queues it will attempt to create for you.
Your MessageEndpointMappings section defines "remote" queues, i.e. your desire to either send messages from Messages to mygateway, or subscribe to Messages from mygateway. Another endpoint, with "mygateway" as its input queue, would be responsible for it up.
So what your app is telling you is "I see that you're interested in exchanging messages with mygateway, but I knocked and nobody's home."

Related

Spring Integration flow for processing/sending email is taking hours for some of the messages

I have spring integration app that transforms the messages using Freemarker and sends message to SMTP server. It was working fine in production for almost an year.
The process itself is not huge, message-driven-channel-adapter reads the message, freemarker transforms the message and EmailAdapter sends the email.
It used to take around 100ms for sending email after getting the message from MQ. However for last few weeks 10% of the messages are taking more than 12 hours to between reading the messages from MQ and getting to EmailAdapter
other 90% (similar)
message are still getting processed in around 100ms.
<!-- Email -->
<!-- Split message into separate email messages for delivery -->
<splitter id="EmailSplitter"
input-channel="EmailDeliveryChannel"
output-channel="EmailDeliveryProcessChannel" method="split">
<beans:bean
class="com.ne.splitter.EmailSplitter">
<beans:property name="mailSender"
ref="MailSender" />
</beans:bean>
</splitter>
<!-- Added task executor to handler messages in dedicated threads. Otherwise one failed email delivery will fail all split messages. -->
<channel id="EmailDeliveryProcessChannel">
<dispatcher
task-executor="SplitDeliveryExecutor" />
</channel>
<task:executor id="RequestTaskExecutor"
pool-size="2-100"
queue-capacity="500"
keep-alive="1" />
<task:executor
id="SplitDeliveryExecutor"
pool-size="3-200"
queue-capacity="1000" />
<service-activator
input-channel="EmailDeliveryProcessChannel"
output-channel="EmailDeliveryStatusChannel" method="send">
<beans:bean
class="com.ne.adapters.EmailAdapter">
<beans:property name="mailSender"
ref="MailSender" />
<beans:property name="retryAttempts" value="3" />
</beans:bean>
</service-activator>
Why some of the messages are stuck in the process for more than 10 hours and not timing out?
Would be grate to turn on debug for org.springframework.integration category and analyze logs for steps where messages are stuck. You can gather a message history for them via WireTap and alert somewhere. See docs about them: https://docs.spring.io/spring-integration/docs/5.0.8.RELEASE/reference/html/system-management-chapter.html#message-history.
Nevertheless it seems for me that the real problem with sending emails, essentially connection to the server, so nothing is wrong with your app. It is just a throughput the provider allows you to interact with it.
You may consider to place a QueueChannel before email Adapter to buffer messages for future processing do not effect the whole flow and don’t block the JMS consumer thread.

KeePass, GoogleSync: "Error occurred while sending a direct message or getting the response"

When using KeePass with the GoogleSync plugin (to sync the keypass db with Google Drive), I somehow messed up my config and received this message on every sync attempt:
Error occurred while sending a direct message or getting the response
I think what I actually did was try to switch my Google API credentials (from one API key to another)
The user config saves a Google auth key. In my case I changed the API credentials I wanted to use, but it could become corrupted in other ways and there doesn't seem to be a mechanism in KeePass/GoogleSync to rectify it.
Exit KeePass
Delete (or backup to a different name) the file %LOCALAPPDATA%\Dominik_Reichl\KeePass[...]\[version]\user.config
Restart KeePass and it'll regenerate it with the correct config
Found my reference here:
http://sourceforge.net/p/kp-googlesync/discussion/general/thread/5dc763ba/

Box API v2 Create a Shared Link for a File with permissions.download config return 500 Internal Server Error

Here is the params that I sent along with create shared link and got "Internal Server Error"
{"shared_link":{"access":"Collaborators","permissions":{"download": true}}}
This is a case of (1) bad documentation and (2) a bad error response.
You're seeing an error because the permissions parameter can only be used with the Open and Company access types*.
On (1) we should have this documented (I just updated our documentation to reflect this). On (2) we should be returning a more descriptive error (e.g. a 400 Bad Request and a message of " doesn't work with this access type. This is also in our development pipeline) "
*If you're really curious, it doesn't work with the Collaborators type because it's expected that the permissions set by the collaboration for each user will define their shared link access. Not the most straightforward thing, I understand.

NLog mySQL database as target configuration

I am using Nlog with MYsql as target database.
MY configuration is as below:
<target name="databaselog" type="Database" keepConnection="true"
useTransactions="false"
dbProvider="MySql.Data.MySqlClient"
connectionString="Server=localhost;Database=****;User ID=****;Password=****;Connect Timeout=5;"
commandText=" insert into logs(time_stamp,logger,message,log_level) Values(#TIME_STAMP,#LOGGER,#MESSAGE,#LOGLEVEL)">
<parameter name="#TIME_STAMP" layout="${longdate}"/>
<parameter name="#LOGGER" layout="${logger}"/>
<parameter name="#MESSAGE" layout="${message}"/>
<parameter name="#LOGLEVEL" layout="${level:uppercase=true}"/>
</target>
.
Still not able to insert the info or any level message in MYSql DB.
Can anyone please help me out ?
bye the I also tried command text as
insert into logs(time_stamp,logger,message,log_level) Values(?,?,?,?)
but not able to insert the data in mysql db.
From NLog docs:
NLog is designed to swallow run-time exceptions that may result from logging. The following settings can change this behavior and/or redirect these messages.
<nlog throwExceptions="true" /> - adding the throwExceptions attribute in the config file causes NLog to stop masking exceptions and pass them to the calling application instead. This attribute is useful at deployment time to quickly locate any problems. It’s recommended to set throwExceptions to "false" as soon as the application is properly configured to run, so that any accidental logging problems won’t crash the application.
<nlog internalLogFile="file.txt" /> - adding internalLogFile causes NLog to write its internal debugging messages to the specified file. This includes any exceptions that may be thrown during logging.
<nlog internalLogLevel="Trace|Debug|Info|Warn|Error|Fatal" /> – determines the internal log level. The higher the level, the less verbose the internal log output.
<nlog internalLogToConsole="false|true" /> – determines whether internal logging messages are sent to the console.
<nlog internalLogToConsoleError="false|true" /> – determines whether internal logging messages are sent to the console error output (stderr).
Right click on NLog configuration file. Set value to "Copy always" of property "Copy to Output Directory"

local NServicebus Post to an Azure queue

We have an on premises web app that uses NServicebus and we want to move the queues to azure (as part of a larger migration path to entirely cloud based). I am trying to work up a POC but can’t seem to get it working.
I have the following configuration:
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821" />
<section name="AzureQueueConfig" type="NServiceBus.Config.AzureQueueConfig, NServiceBus.Azure"/>
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core"/>
<section name="MessageForwardingInCaseOfFaultConfig" type="NServiceBus.Config.MessageForwardingInCaseOfFaultConfig, NServiceBus.Core"/>
</configSections>
<MessageForwardingInCaseOfFaultConfig ErrorQueue="error" />
<AzureQueueConfig QueueName="timeoutmanager"
ConnectionString="DefaultEndpointsProtocol=https;AccountName=<My storage account>;AccountKey=<My primary access key>"/>
<UnicastBusConfig TimeoutManagerAddress="timeoutmanager">
<MessageEndpointMappings>
<add Messages="TechFu.Services.Bus.Messages.Publishing.CMS.SitePagePublishMessage, TechFu.Services.Bus.Messages" Endpoint="sitepagepublish" />
</MessageEndpointMappings>
In my application I have the bus configures as:
Configure.WithWeb()
.StructureMapBuilder()
.InMemorySubscriptionStorage()
.AzureMessageQueue()
.JsonSerializer()
.UnicastBus()
.LoadMessageHandlers()
.IsTransactional(true)
.CreateBus()
.Start();
When I try posting to the queue, I get the following message:
The destination queue 'sitepagepublish# DefaultEndpointsProtocol=https;AccountName=<My storage account>;AccountKey=<My primary access key>’ could not be found. You may have misconfigured the destination for this kind of message (TechFu.Services.Bus.Messages.Publishing.CMS.SitePagePublishMessage) in the MessageEndpointMappings of the UnicastBusConfig section in your configuration file. It may also be the case that the given queue just hasn't been created yet, or has been deleted.
I’m at a bit of a loss, I’ve tried several different samples I’ve found on the web, but I feel like my lack of azure knowledge is getting in the way. I pulled the majority of the configuration from this question: nservicebus on-premise host using azure Queue Is there some magic that I’m missing?
Does the destination queue exist? NServiceBus only creates source queues by default so if the destination does not exist it won't create it for you.
I don't think this will work because the subscription messages can't be exchanged between both of the hosts.
Better use Gateway concept of NServiceBus which will distribute messages across different sites.
Could you try removing any reference to MsmqTransportConfig from your configuration file? (when using Azure queues you are actually replacing the MSMQ transport)
I am not familiar with NServicebus. But Windows Azure has a built-in Service Bus, and it can integrate with queue naturally. You can refer to http://msdn.microsoft.com/en-us/WAZPlatformTrainingCourse_ServiceBusMessaging for a tutorial.
Best Regards,
Ming Xu.