i am able to connect to asmq channel using rabbitmq in my local machine using below code.
but i want to connect to this channel in different machine and receive data.
amqp.connect('amqp://localhost', function (err, conn) {});
Related
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.
Is it possible to get notified that a device has connected to IoT hub without polling?
The only option I've found is to poll RegisteryManager.GetDevicesAsync() and loop through the registered devices to see if they are connected or not. I could poll, however I have no idea what sort of throttling limits exist.
That code looks like:
var devices = await registryManager.GetDevicesAsync(maxCountOfDevices);
if (devices != null)
{
foreach (var device in devices)
{
// do something with the connection state like
// notify services
device.ConnectionState
}
}
What I'd like is to be able to get all registered devices, keep them in memory, and just listen for connection events.
Microsoft Azure IoT team suggests implementing the heartbeat pattern because connectionState is not accurate:
https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-identity-registry#device-heartbeat
I Tried it with operation monitoring in Azure IOT Hub. It provide an event hub endpoint to read the verbose operation. So here i find the event of connection and disconnection of IOT device to IOT hub. But now the issue is device messages and connection/disconnection events are async.
i use to connect to my local redis instance like so(when my client and redis server were on the same box,
var client=redis.createClient();
and i can easily connect to the server.
however, if my redis server is on a remote machine host_name:6379, I cant make createClient function to work.
var client=redis.createClient('6379', 'host_name', {no_ready_check:true}); //gives the below error
Error: Redis connection to host_name:6379 failed - read ECONNRESET
at exports._errnoException (util.js:746:11)
at TCP.onread (net.js:559:26)
Process finished with exit code 1
what am i doing wrong. the remote server is a linux machine that i need to ssh into using my username password. How would i provide that info inside createclient function.
any help would be appreciated. thanks
We are working on a signalR client that needs to connect to a local Hub to which other local users connect and a cloud Hub. The connection to the local Hub will receive messages from the local users and after applying some logic will retransmit the message to the cloud Hub clients. What would be the right way to implement this functionality ? Thanks.
I am curious why ConnectionMultiplexer.Connect(options) attempts to connect 2 clients to the RedisDB instead of 1? Each time I connect I see that 2 additional clients connect to my RedisDB.
Because redis requires separate connections for interactive commands versus pub/sub subscriptions. If you aren't using pub/sub, you could tell the options to disable the SUBSCRIBE command, in which case I believe the second connection is not established.
You can turn off second connection if you don't use redis pub/sub
var config = ConfigurationOptions.Parse(redisConnectionString);
config.CommandMap = CommandMap.Create(new HashSet<string> { "SUBSCRIBE" }, false);
connection = ConnectionMultiplexer.Connect(config);