what is exactly Publisher confirms in Rabbitmq? - rabbitmq

I read the official document of Rabbitmq, it is not really clear for me what was that?
its something like Consumer Ack but with a difference that the Publisher Confirm is send by rabbitmq server to Publisher client when the server get the message from publisher client?
Can someone explain more about it?
thanks in advance.

its something like Consumer Ack but with a difference that the
Publisher Confirm is send by rabbitmq server to Publisher client when
the server get the message from publisher client?
Yes. When you enable publisher confirms, and your publisher receives acknowledgement that the message is published, you can be certain of it.
Without publisher confirms, you can lose messages in several cases. One example: your application could publish the data to the TCP buffer, but then crash, or the server itself could crash. Another example: a network device could fail mid-delivery. Another example: RabbitMQ itself could crash after receiving the TCP data containing your message.
NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.

Related

How to know in Objective C if a message is already sent to the rabbitmq server?

I am using rabbitmq client (https://github.com/rabbitmq/rabbitmq-objc-client). I wanted to notify whether or not a message is sent to the rabbitmq server, but I couldn't find anything related to whether or not the message is really sent.
Could someone tell me how to know if I publish a message to a queue and the message really arrives to the rabbitmq server?. Thanks in advance !
Kinh
Publisher acknowledgments are on the amqp level, handled by RMQ itself. In the "API" level you may get a exception or a return value or some indication depends on the library.
Quote from the aforementioned link:
For unroutable messages, the broker will issue a confirm once the
exchange verifies a message won't route to any queue (returns an empty
list of queues). If the message is also published as mandatory, the
basic.return is sent to the client before basic.ack. The same is true
for negative acknowledgements (basic.nack).
For routable messages, the basic.ack is sent when a message has been
accepted by all the queues. For persistent messages routed to durable
queues, this means persisting to disk. For mirrored queues, this means
that all mirrors have accepted the message.

RabbitMQ - How to save message for new consumer

Working on a new chat project, We want to use RabbitMQ to transfer our message.
So can RabbitMQ save all the message in queue or some other place, when an new people(consumer) comes, the RabbitMQ can flush the saved message to the new people?
If you use a persistent queue, rabbitmq can store the messages (the messages are stored in the same mnesia-db path).
So suppose that each user has a own queue, when the user gets on line can download the messages.
Anyway I don’t think it is a good idea use rmq to push messages for chat. There are others appropriate technologies, like MQTT, XMPP.
I suggest to read this post:
using rabbitmq in android for chat
Please read the tutorial to understand what RabbitMQ is.
RabbitMQ is a message broker: it accepts and forwards messages. You can think about it as a post office: when you put the mail that you want posting in a post box, you can be sure that Mr. or Ms. Mailperson will eventually deliver the mail to your recipient. In this analogy, RabbitMQ is a post box, a post office and a postman.

NserviceBus - What happens to a message if the server is offline

I went thought NServiceBus documentation including the durable messaging one. What I understand is that when the server is offline the messages continue to go into the server's input queue which get picked up when server comes back online.
But what if the server is completely down and the input queue is not accessible?
I'm using Bus.Send from the client.
It depends on what transport you're using.
In the case of a brokered message queue, like Azure Service Bus, as long as that service is available, the fact the machine that will eventually retrieve the messages is offline is irrelevant, as that machine is simply asking the external queuing service for messages. The same goes for a transport like SQL Server.
In the case of a transport like MSMQ, which is a store a forward style queue, the messages will remain in a local outgoing queue until the remote machine becomes available.
Can you double check that you are looking in the correct spot? If you aren't getting an error out of NServiceBus when you Send, then MSMQ is installed. If it can't be reached or the service is stopped you should get errors.
The Outbound queues are in a different place as illustrated here:
http://blogs.msdn.com/cfs-filesystemfile.ashx/__key/communityserver-components-postattachments/00-09-06-31-16/outgoingempty.JPG
As RMD indicated, this is an advantage of the store and forward MSMQ transport.. the local outbound queue should just stack these up until the remote server is available.
Thx.
Joe

RabbitMQ subscriber notification in .NET

We are using MSMQ right now with WCF activation feature, it enables us not to pull queue to read messages. It like push message to application.
As we are looking at porting from MSMQ to RabbitMQ going through what we need from message queue.
I can't anything regarding RabbitMQ .net client support for receiving message notification from subscribed queue?
Is there anything in RabbitMQ with .net which can do push notification to subscriber like MSMQ?
Or we need service running which constantly checks for message?
In AMQP (and RabbitMQ), there are two ways to retrieve messages: basic.get and basic.consume.
Basic.get is used to poll the server for a message. If one exists, it is returned to the client. If not, a get-empty is returned (the .NET method returns null).
Basic.consume sets the consumer for the queue. The broker pushes messages to the consumer as they arrive. You can either derive DefaultBasicConsumer, which gives you your own custom consumer, or you can use the Subscription Message Pattern, which gives you a blocking nextDelivery().
For more information, check out the API guide linked above and the .NET Client Userguide. Also, a great place to ask RabbitMQ-related questions is the rabbitmq-discuss mailing list.
I think you are after something like the EventingBasicConsumer. See also this question/answer
That is a feature provided by WAS (Windows Activation Service). Right now WAS has listener adapters for net.pipe, net.msmq and net.tcp (and its port sharing service). I guess you would need a specific AMQP listener adapter.
This may help http://msdn.microsoft.com/en-us/library/ms789006.aspx

NServiceBus: What happens to a published message if my subscriber machine is powered off?

With simple Pub/Sub in NServiceBus, I know that if my subscriber app is not running, then the published messages will just accumulate in the queue until they can be processed. But where do they accumulate if the entire machine is down? Since the message can't even be delivered to my subscriber queue, is there some queue where they sit on the publisher? I would like to be able to see what messages are waiting on the publisher when the subscriber machine is down.
Is there any way to see them?
Msmq, the default transport for NServiceBus, uses the store and forward pattern to deliver messages. That means that when you send a message to another machine it's first "stored" on the machine that sends the message and then "forwarded" to the recipient machine. This means that outgoing messages to unreachable machines will be stored on the sending machine until they can be delivered. Msmq uses the terminology of "outgoing queues" for temporary storage of messages that are being delivered. If the receiving machine is down the message will sit in the "outgoing queue" until it can be delivered. If you look at the "Message Queuing" MMC plugin you will find a folder called "Outgoing Queues", this is where your published messages will show up if the subscriber is down.
IMO, the best resource for info on Msmq is John Breakwells blog:
http://blogs.msdn.com/b/johnbreakwell/archive/tags/msmq/
More info on NServiceBus combined with Msmq:
http://docs.particular.net/nservicebus/msmq/
Hope this helps!