Dapr pub-sub connection refused - asp.net-core

I have an endpoint wired up to subscribe to an Azure Service Bus Topic. Something like this:
[Topic("my-component", "my-topic")]
[HttpPost("[action]")]
public async Task<ActionResult<MyResponse>> DoIt(CloudEvent cloudEvent)
{ ... }
Sometimes, the processing is failing. It just seems to stop in the middle of processing. From stdout I see this from the sidecar daprd container:
time="2023-02-02T17:13:30.699870594Z" level=error msg="App handler returned an error for message 73b53011f9b54ec4a1563d790fa3db99 on topic blah-topic: error from app channel while sending pub/sub event to app: dial tcp4 127.0.0.1:80: connect: connection refused" app_id=my-app instance=my-app--5deqq11-59465485d4c-n52rv scope=dapr.contrib type=log ver=1.9.5-msft-2
What doesn't make sense is the connection refused. I'm subscribing not publishing. Connection to what is refused?
It seems like this is happening on long-running requests so timeouts come to mind but that doesn't add up w/ connection refused.
What does that error mean? Is it a red herring or related to the failure of some of my messages? 🤔

Related

RabbitMQ: None of the specified endpoints were reachable?

Trying to publish a message to RabbitMQ using Masstransit but its failing.
I've looked at a few SO posts on this but none have a concrete answer. I've tried different ways of formatting the connection string, hard coding, etc but nothing seems to work.
If I connect outside of the app just via the browser, everything works fine.
In my app though, it just can't connect?
[09:09:46 WRN] Connection Failed: rabbitmq://{host}:15672/
RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable
---> System.IO.IOException: connection.start was never received, likely due to a network timeout
I'm registering it like:
serviceCollection.AddMassTransit(x =>
{
x.UsingRabbitMq((rabbitContext, rabbitConfig) =>
{
rabbitConfig.Host(new Uri("amqps://{host}:15672/"), h =>
{
h.Username("admin");
h.Password("...");
});
rabbitConfig.ConfigureEndpoints(rabbitContext);
rabbitConfig.Durable = true;
});
});
If I just use the RabbitMQ library it also connects fine, so Masstransit seems to be the issue here?
/var/log/rabbitmq/rabbit#mg.log only logs failed connections via the management panel it seems, at least its not logging for failed app connects.
Check that you are using the right network port. Port 15672 is the default port for the web-based management console, which is not the same port MassTransit needs to connect to. That defaults to 5672 for plain AMQP, and 5671 for TLS-secured AMQP.
To confirm which ports your RabbitMQ server is listening on, and that your web server can access them see this troubleshooting guide and the answers to this question.

Handling BizTalk dynamic WCF-WebHttp ports suspended messages

I am creating a Biztalk dynamic port WCF-WebHttp.
When I get a response back in the form of a HTTP 404, the port suspends the following error is shown
System.Net.WebException: There was no endpoint listening at https://test.xxx.com/xxxx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
{"type":"availability.not_found","message":"No availability was found for the properties requested."}
I have tried to add an exception handler to the BizTalk orchestration. It handles the error but I still see a suspended instance.
I wish to handle the 404 error and to stop the port from suspending.
In Transport Advance Options on your Send Port Properties, switch on Enable routing for failed messages.
Have something subscribing to the Error Report from that send port, e.g. we use a custom Null Adapter with the rule ErrorReport.SendPortName == NameOfSendPort
There's a few things you have to setup around this for it to work 'as expected'.
This article: BizTalk Server: Suspend and Resume an Orchestration on Two Way Port Error
...describes how to setup the Orchestration, the Port and handling the failure notifications.

Spring Cloud Stream : Sink loses RabbitMQ connectivity

I see that my custom Spring cloud stream sink with log sink stream app dependency loses RabbitMQ connectivity during RabbitMQ outage, tries making a connection for 5 times and then stops its consumer. I have to manually restart the app to make it successfully connect once the RabbitMQ is up. When I see the default properties of rabbitMQ binding here, it gives interval time but there is no property for infinite retry(which i assume to be default behaviour). Can someone please let me know what I might be missing here to make it try connecting infinitely ?
Error faced during outage triggering consumer retry :
2017-08-08T10:52:07.586-04:00 [APP/PROC/WEB/0] [OUT] Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - home node 'rabbit#229ec9f90e07c75d56a0aa84dc28f602' of durable queue 'datastream.dataingestor.datastream' in vhost '8880756f-8a21-4dc8-9b97-95e5a3248f58' is down or inaccessible, class-id=50, method-id=10)
It appears you have a RabbitMQ cluster and the queue in question is hosted on a down node.
If the queue was HA, you wouldn't have this problem.
The listener container does not (currently) handle that condition. It will retry for ever if it loses connection to RabbitMQ itself.
Please open a JIRA Issue and we'll take a look. The container should treat that error the same as a connection problem.

Check if BeginPeek is still Subscribed

I am using BeginPeek() /no params/ to subscribe to messages coming in to my private queue. This is being done in a service hosted in NServiceBus host. When NServiceBus encounters transport connection timeout exception (i'm seeing circuit breaker armed logs and timeout exception logs), the peek event subscription seems get lost. When database connectivity becomes stable and new messages come in to my queue, the service is no longer notified.
Any ideas or suggestions on how to address this?

ActiveMQ Durable consumer is in use for client and subscriptionName via STOMP

I have an iOS client that connects to several ActiveMQ topics and queues via STOMP protocol. When I connect to the server, I send the following message:
2012-10-30 10:19:29,757 [MQ NIO Worker 2] TRACE StompIO
CONNECT
passcode:*****
login:system
2012-10-30 10:19:29,758 [MQ NIO Worker 2] DEBUG ProtocolConverter
2012-10-30 10:19:29,775 [MQ NIO Worker 2] TRACE StompIO
CONNECTED
heart-beat:0,0
session:ID:mbp.local-0123456789
server:ActiveMQ/5.6.0
version:1.0
And then, I subscribe to several topics using the following message:
2012-10-30 10:19:31,028 [MQ NIO Worker 2] TRACE StompIO
SUBSCRIBE
activemq.subscriptionName:user#mail.com-/topic/SPOT.SPOTCODE
activemq.prefetchSize:1
activemq.dispatchAsync:true
destination:/topic/SPOT.SPOTCODE
client-id:1234
activemq.retroactive:true
I'm facing two problems with the ActiveMQ server. Each time I connect, the Number of Consumers column in the web interface gets incremented, so I have just one real consumer but the count is around 50 consumers. But the most problematic issue is that when I plug another iOS device into my laptop to test the messaging environment, i get the following error when connecting to ActiveMQ:
WARN | Async error occurred: javax.jms.JMSException: Durable consumer is in use for client: ID:mbp.local-0123456789 and subscriptionName: user#mail.com-/topic/SPOT.SPOTCODE
This seems to be that disconnecting from ActiveMQ via STOMP is not working propertly, because this logging attempt is made when the other device is not running the app. I've tried the following things in order to solve the issue:
Always logoff when attempting to subscribe to the topics.
Subscribe
I'm currently using v5.6.0 executing the server on my laptop.
IF you read the STOMP page on the ActiveMQ site you will notice that client-id and activemq-subscriptionName must match in order to use STOMP durable subscribers. These value should be different for each of you client's otherwise you will see the same errors because of the name clashes.