Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am trying to incorporate RabbitMQ based pub sub for a specific programming scenario,
I have a Web API endpoint. When I get a 201 response from this service I want to send out emails.
I already have another API endpoint which I can call to send out email.
Where do I setup the mailer?
And how do I setup RabbitMQ to handle this scenario?
To clarify further, should this be a fanout exchange setup or not? And how are mails usually handled transient or persistent queues?
Sounds like a typical worker scenario where one side will queue up jobs/messages into a message queue (producer) and the other side will get the messages and process them (consumer/worker). In your case, the workers will get messages and send out an email (or hit your api endpoint that sends out emails). The workers typically run on separate machines so they can do work without affecting your application or api.
If you're using RabbitMQ, you should read the "Work Queues" tutorial to see how to set it up for your scenario: http://www.rabbitmq.com/tutorials/tutorial-two-python.html
There are some hosted solutions specifically for this too that don't require any setup like IronMQ for a message queue. Or even a step further if you don't want to deal with worker servers, you can use IronWorker.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I want to create an application which will be multiple client server application. All the computers are connected via the LAN. I want to generate a push notification on the admin computer when a client makes a query request. The notification should be real-time without loading the dashboard.
If you are up for rolling your own, you could potentially look into RabbitMQ. Its a free open source robust messaging system that would allow you to publish message to an exchange from the admin computer. Then the clients would subscribe to get the notifications/messages.
They have good getting started tutorials over on the main website. In particular, you might want to look at the Publish/Subscribe tutorial
You can use nuget to pick up the offical RabbitMQ C# library. Although, once you have your exchange & queues setup inside RabbitMQ you can even send the messages to the queue from anywhere using HTTP POST messages if you wish.
However, you would need to setup RabbitMQ on a server somewhere which might be a deal breaker if you havent got access to a server to install rabbitMQ on. It would need to sit there in the background to processing the messages for you.
That my 2 pence worth.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am new to .NET/C# and I am wondering how oyu could achieve the following scenario:
I need a REST Api with has one endpoint, which accepts a message(string).
That message should be stored in a Queue and then there should be one or multiple Threads that consume and process this Queue.
I do not want to use Hangfire, RabbitMq etc. The only thing that I have seen is to use NancyFx to create the Rest API in a Console application and from there I can achieve the described scenario, but is it possible in .NET Core WebApi, because you cannot create Threads there ?
You can use Asp.Net Core Webapi and use Task Instead of Thread. If you don't use any other third parties such as RabbitMq, Redis, or other message queue, you have to create a shared variable such as a Dictionary or a List and implement synchronization mechanism (such as using Lock) by yourself to avoid any problem caused by concurrency.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am about to figure out functionality of rabbitmq.
Lets say that i have 10 clients and each client have a database which is behind firewall or some other security layer (so there is no way to access data in database directly).
Now how will it be possible to receive data from database at each client using rabbitMQ?
My thought is to create a rabbitmq server and a listener. Each client will have a copy of that listener. So to retreive data from the client i will send a message to client's listener and wait for response.
But i cant figure out how to implement the wait for response part? As i understand i will need to implement RPC call, but that means that each client will need a queue of it own?
Did anyone implemented such functionality?
I think that you want to address individual clients.
You could do it with dedicated queues as you stated. In such a design your clients will be allowed to reply to the requests even if offline: once they start and connect to RabbitMQ, they will find the requests and answer to them.
Viceversa, if you want to let the client reply only if online, I would choose a different approach: use a topic exchange and let each client bind with a temporary queue and consume messages that match the published topic - for example the topic could be (or could contain) the hostname of the client: only the addressed client will consume it.
In both cases the clients will need to reply to the requests. The simplest way is to let the requester create a temporary queue and let it be specified in the requests, in the "reply-to" property of the message, as depicted in this tutorial.
The clients will reply filling the message with the local DB contents and sending a message to such a queue.
So to retreive data from the client i will send a message to client's
listener and wait for response.
When dealing with messaging you never wait: you just "react to messages". The requester will be set up consuming messages from the "reply-to" queue. When a response arrive there, the requester will act consequently.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I've got some work to do for school around Microservices.
I've got the architectural concept, but need an implementation to show off. I'll be using angular2 as a client, would like to use a .NET core API gateway to dispatch my requests to different services.
What's the best approach for this? I red something about using Rx.Net, but no definitive example or implementation that I can follow.
So what should I do to implement an API gateway in .NET Core?
This may or may not help but I am currently building an API gateway in .NET core.
You can find it at https://github.com/TomPallister/Ocelot.
The code is a little ropey but a few people are working on it now so hopefully we can improve it over time.
You want to have a server that listens to the incoming API calls, e.g. a HttpListener.
Inside the handler of incoming requests, you peek into the request and decide where the API call needs to be relayed.
Then you use something like a HttpClient to make another request to the actual API endpoint (mimicking the original request as closely as possible) and you relay its response back to the user.
It should all be in the listener's request handler, and the response to the original request is the response from the real API.
See MSDN docs on HttpListener.
Also a good read: Handling multiple requests with C# HttpListener
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have a question regarding a Windows C# services.
Is it possible for the window service to run in background and send/Receive its data to a C# standalone application with opened by a user. if so how is it that it can be done?
Is there any other better ways for building a window service
Yes this can be done, and there are several options. For inter-process communication - which is basically what you are asking for - you could consider WCF with NamedPipes or TCP, or a message queue (MSMQ, RabbitMQ etc).
Typically with a message queue the messages will queue if the service or client is not there, or with named pipes or TCP a current connection must be available.
WCF named pipe minimal example
Yes, it's possible. You can run a service like windows service, expose methods, and one or more client can use it.
One example is this.
Bye bye.