I am trying to figure out Masstransit 2.9.9 and RabbitMQ 3.4.3. I have RabbitMQ installed on a server and am trying to get a simple console application from my desktop to send a message. I created another administrator login.
I keep getting permission errors and the bus won’t initialize.
ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.
When I look in the log files, it seems to use guest even when I send another login.
IServiceBus bus = ServiceBusFactory.New(sbc =>
{
sbc.UseRabbitMq(r =>
{
r.ConfigureHost(new Uri("rabbitmq://server/vhost/queue"), h =>
{
h.Validate();
h.SetUsername("user");
h.SetPassword("pwd");
});
}
sbc.ReceiveFrom("rabbitmq://server/order_queue");
}
I saw something about maybe needed to configure ssl for rabbit but i'm not sure.
Any ideas?
Thanks
I had exactly the same problem (I am testing first time Masstransit & rabbitMq). I added username and password in Uri:
new Uri("rabbitmq://user:pwd#server/vhost/queue")
I think that your ReceiveFrom address needs username and password. Also vhost is needed.
sbc.ReceiveFrom("rabbitmq://user:pwd#server/vhost/order_queue");
After banging my head, it appears the rabbit client that comes with the masstransit rabbitmq nuget package is slightly out of date. I did an update and the code works. The only change was to remove queue from the configurehost
r.ConfigureHost(new Uri("rabbitmq://server/vhost"), h => ....
Related
I have a Windows Service that runs some processes and it must be notify the progress of it on the browser. I am not sure if I am doing something that is good but I just did it:
Windows Service publish a json on a redis channel called 'web' -> An action on ASP.NET MVC application subscribe the 'web' channel and send the json to browser via signalR hub -> the browser take it and show the progress.
I have the following code (it is a helper) to add a channel scope after a publish. It is called from my controller/action:
public void Listen(string channel, Action<string, object> action)
{
var sub = Client.GetSubscriber();
sub.Subscribe(channel, (c, v) =>
{
action(c.ToString(), v.ToString());
});
}
The problem: It works as expetected and I get the browser notified. The problem is when the user (on browser) hits F5 or executes the action again. It creates a new channel and I get duplicated messages. If the users executes again it, I started getting 3 messages for each one and so on. I want to avoid it.
What I have tried: I tried to use the IsConnection(channel) but it always returns true. I have tried to Unsubscribe(channel) before Subscribe(channel) again and it works but I am not sure if i will lost some messages (I am afraid). I do not know how to solve it and avoid getting duplicate subscriptions. Does anyone can help me?
Thank you.
Are you using the ConnectionMultiplexer? See Using redis pub/sub.
... in the event of connection failure, the ConnectionMultiplexer will
handle all the details of re-subscribing to the requested channels
Consider switching from Pub/Sub to Redis Streams. See What are the main differences between Redis Pub/Sub and Redis Stream?
You can name groups and clients with Consumer Groups. Therefore you can control it by session, or anything else, or even use something like fingerprint.js to identify each browser anonymously.
I've a web job that is trying to send an email when it reads something from the Azure poision q.
public static void ProcessPoisonNotification(
[QueueTrigger("parkingticketnotification-poison")] ParkingTicketNotificationBO notificationBo,
TextWriter log)
{
var message = "xxx xxx xxx xxx xxx => POISON message: " + notificationBo.Dump();
Console.WriteLine(message);
log?.WriteLine(message);
PoisonEmailNotifier.SendFailureMessage(notificationBo);
}
The Email notifier is using code from the main web applicaiton, which can send emails. but the Web job throws the following exception. Is it because the web application is blocking port 25?
The Email notifier is using code from the main web applicaiton, which can send emails. but the Web job throws the following exception.
Base on my experience, as the Web application and WebJob are in the same environment, if it is worked in the Web application, it should be also worked in the Azure WebJob.
If WebJob is worked locally, please have a try to remote debug the WebJob. More details about how to remote debug the webjob, please refer to the tutorials.
Note: Click the Settings tab, and change Configuration to Debug, before it is published.
Besides,we also can use Azure SendGrid to send email easily.
That looks like Windows Socket Error Code 10013. You can find out more about it here.
Microsoft has two suggestions - you likely either have insufficient permissions or another service is bound to the target port. If you know that traffic on port 25 is not open on your host, it seems likely that this is the cause. However, you may instead have some other service listening to that port.
I want to get notifications when a new feed has landed on a designated page (by page id). After what I understand, the Realtime-update og Graph API should be able to do this trick according to https://developers.facebook.com/docs/graph-api/real-time-updates/v2.4.
So I want to add a new subscription, which I try to do with the following code:
dynamic result = client.Post(urlPath, new
{
#object = "page",
callback_url = callbackUrl,
fields = "feed",
verify_token = "654321",
access_token = accessToken
});
return result;
But when I try to run this, I'm getting the following error code:
(OAuthException - #2200) (#2200) callback verification failed: Received HTTP code 502 from proxy after CONNECT"
What do I miss?
The callback url is https://127.0.0.1:8989/ and I have a TcpListener running on the port, which does not seem to get any response/request incoming...
The application is a C# console application, so no fancy asp.net stuff or something. I'm using the Facebook .net SDK.
Should I FacebookClient.VerifyPostSubscription() or anything else that I missed out?? Maybe the SDK wraps a handle?
So the answer I'm looking for is:
- How do I create/add a subscription for feeds of a facebook page, using the .net SDK on a windows console project??
UPDATE:
I changed the loopback with a domain name, that I the NAT to my target machine, and now I actually get some encrypted data on my TcpListener!
So, the question now is, how do I respond correctly to this received respons, only by using a Tcp Client??
How you have to respond is exactly outlined in the docs you linked:
https://developers.facebook.com/docs/graph-api/real-time-updates/v2.4#setupget
It's not really clear what you mean with "TCP listener". You need to have some logic why can send HTTP responses to the Facebook servers, otherwise your service will be disregarded after some time, meaning no updates will be send.
Typically, this is implemented as a script/application in a web/application server.
Please note: The "C# SDK" is a third-party SDK and not officially supported by FB.
Setup:
Masstransit verion: 2.10
RabbitMq Client: 3.4.3.0
RabbitMq Server : 3.5.3 (used default ports and configurations)
Erlang 17.5
I can access the RabbitMQ web management client and able use the rabbitMQ locally. The problem is deployed in data center.
the code:
ServiceBusFactory.New(sbc =>
{
sbc.UseRabbitMq(r => r.ConfigureHost(new Uri("rabbitmq://actual-server-name/queue-name"), h =>
{
h.SetUsername("username");
h.SetPassword("password");
}));
sbc.ReceiveFrom("rabbitmq://actual-server-name/queue-name");
sbc.Subscribe(x => x.LoadFrom(container));
});
I got an exception error:
It came from MassTransit.Exceptions.MassTransitException. When you dig down inside it from RabbitMQ itself.
RabbitMQ.Client.Exceptions.BrokerUnreachableException : None of the specified endpoints were reacheable.
System.IO.Exception : connection.start was never received, likely to a network timeout. found in Masstransit.ServiceContainer.cs line: 63
Why it throwing error; since the rabbitmq server installation is same in my local setting? permission issue? firewall issue?
I observed and verified in my testing; masstransit does not allow creating of vhost from uri input. RabbitMQ will throw most likely the same error.
To resolve this issue, create the vhost and queue manually in rabbitmq server.
PS. I knew, this is not the same as the question ask.
One can create the queue through the code but not the vhost. So, you have to create the vhost manually and also give proper permissions to access via code.
I am attempting to follow a Windows Azure tutorial to send a message to a topic on Microsoft's Azure service bus. I have created the namespace and the topic. I then set up ACS and grabbed my connection string. My connection string allows Manage, Listen, Send. When I execute my code, the Send(message) just hangs. It never times-out nor does it continue. The CPU is not maxed and I can break out of the code and close the program. No message arrives in Azure. When I watch my network traffic in fiddler, it looks to me like it is never finishing the authentication negotiations. I see a post to my namespace .servicebus.windows.net that returns a 201 then a post and a get at an IP address that belongs to Azure service bus with a /$servicebus/webstring/{guid}. Neither of these web request ever get a response back from the server. Here is my code. It stops running on client.Send(message);
static void Main(string[] args)
{
ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Http;
string connectionString = ConfigurationManager.AppSettings["Microsoft.ServiceBus.ConnectionString"];
var client = TopicClient.CreateFromConnectionString(connectionString, "clients");
Console.WriteLine(client.IsClosed);
var message = new BrokeredMessage("Test message.") {TimeToLive = TimeSpan.FromMinutes(15)};
client.Send(message);
Console.WriteLine("Done");
Console.ReadKey();
}
Any ideas on how to get this code to post a message to Azure service bus?
I'm also seeing this behavior when using this code and it appears to be linked to the ServiceBusEnvironment.SystemConnectivity.Mode you have set. If you comment that out it goes through. That mode isn't mentioned in the tutorial. The default the mode is Auto and it detects if it can send via TCP first.
With that said, I'd like to suggest you use the following code instead:
string connectionString = ConfigurationManager.AppSettings["Microsoft.ServiceBus.ConnectionString"];
MessagingFactory factory = MessagingFactory.CreateFromConnectionString(connectionString);
MessageSender testQueue = factory.CreateMessageSender("TestTopic");
BrokeredMessage message = new BrokeredMessage("Test message ");
testQueue.Send(message);
One of the benefits of using the MessageSender instead of the TopicClient or QueueClient directly is that your code doesn't care if the destination is a Topic or a Queue. If you later needed to change from one to another your code here wouldn't have to change. Likewise, using a MessageReceiver on the consuming code is better as well.
I dont see that issue, I can post the message on a topic with same code and receive it via a subscription as well. The SAS key I use is generated on Topic itself. My the issue you had was temporary issue?
It appears to be our corporate firewall. It is actively refusing connections on unknown ports (9354) instead of passively. This seems to keep the Microsoft library for Azure from auto-detecting the connection and switching to https. It appears that with an active refusal of the connection at 9354 an exception get thrown in the library instead of trying http. Likewise, if I set the mode to just Http, it hangs, but when I am outside the corporate firewall it does not hang. It would be nice if this library worked with an active refusal on port 9354.