I am using RabbitMQ to send data from a server to several consumers. I have to decide when a message will be deleted from the queue so I want to implement that the consumers send a message to the server. If all the consumers send a response then I will remove the message.
I already found an RPC call but I think that is to complex for the problem I have. Is there a faster way to send a quick response to the server? I am using C#.
UPDATE: I think I already found a solution. I will notify the broker so it can be removed from the queue.
You can use prefetch to send multiple messages. The prefetch value is used to specify how many messages that are being sent to the consumer at the same time.
The client can send an ack back to the server, which will delete the message from the broker.
Related
Is it possible to use kafka like api?
It means to send a message and wait to receive the answer.
I have just started programming with Kafka and I have a question about sending messages and receiving processing results.
Producers send events, and you can wait for an acknowledgement from the broker server, yes.
No, you cannot await receiving the consumer in the same action, because that is a separate Kafka function, and consumers poll from topics, rather than listen to the client-local producer events.
I think this is a fairly common problem.
I'm using C# and Rabbit MQ client. I have a publisher sending a message to an exchange. The publisher queue and subscriber queues are all bound to the exchange via a routing key. When the publisher sends a message to the Exchange, all the subscriber queues receive the message as expected, however the publisher queue also receives the message.
is there a good pattern that can be employed to prevent this?
When you send a message, you give the message an Id. Normally a GUID. You could track which messages you send, and if a message you receive is one you know you have sent you could discard it.
However, as Derick said, the best bet is just not to do this.
I am developing a communication layer between client and server using XMPP in c#. The requirement is to send message from client and halt execution until a reply is received from server. Is there any way of doing that using agsXMPP?
Another thing is I don't want server to synchronize the message sending/receiving. It should be only client waiting for the reply. Server should work asynchronously.
Please help if there is any thing available.
You can use standard XMPP IQ requests with your own payload. IQs are specially designed for situations when reply is required.
In agsXMPP there is an IqGrabber class, which can be used to send query and perform callbacks on the query response.
This is rather a stupid question. But I couldn't find a good post regarding this.I want to create a queue in Outgoing queue in MSMQ.
I have a task to get all the Outgoing queues in the machine and clear the messages if it matches to a criteria.
Can anybody give an idea how to create an Outgoing queue in Windows server 2008 machine.
You don't "create" an outgoing queue.
When you send a message to a queue the MSMQ sub-system first writes the message to a local, temporary, outgoing queue before transmitting the message to the destination queue. The lifespan of the temporary outgoing queue is controlled by the MSMQ sub-system and not the developer.
This is because MSMQ uses a store and forward model to transmit messages around.
John Breakwell talks about this here.
However, you can address the outgoing queues in the same way you would address the remote queue which you are sending to, but setting a flag called MQ_ADMIN_ACCESS.
This technique is described here.
I have a winforms client application that sends messages to an asp.net web service, I need to be able to queue these messages on the client and then then send them in order, waiting for a response from the webservice before sending the next message.
I did look at some examples of queueing using WCF but they seemed to have the queue on the server and not the client.
Any advice abotu what technology to use and on how to implement a solution would be very much appreciated.
Why wait for the response of the server before sending the next message? there is no good reason to do that. Just mark the messages with a sequence number and process them in order at the server.
MSMQ has a queue both on the client and the server and moves the message when a connection is available.
There's also good ol' MSMQ, but that queues things on the server as well.
You could use middleware for the queue (MSMQ etc).
An alternative would be a thread-safe producer/consumer queue at the client. Your "main" code just adds to the queue (ConcurrentQueue in 4.0 might work nicely here, although even in 4.0 I tend to use a utility queue I wrote a while ago instead); and you have a dedicated worker thread that dequeues messages, does the WCF work, and processes the response.
If you need reliable delivery, why not use AMQP with a message broker like RabbitMQ?