Overview
Simple instant messaging application in C. It is intended as an example of how to send and receive messages via OpenAMQ WireAPI.
To compile and link the files set your environment in the same way as you do to build OpenAMQ server and do the following:
$ c -l im_sender.c
Compiling im_sender...
Linking im_sender...
$ c -l im_receiver.c
Compiling im_receiver...
Linking im_receiver...
To run the whole thing, you have to start OpenAMQ server first:
$ amq_server
Once the server is running you can run chatroom window this way:
$ im_receiver <broker-address> <chatroom>
For example:
$ im_receiver localhost:5672 "OpenAMQ discussion"
To send messages to the chatroom, you have to run sender window this way:
$ im_sender <broker-address> <chatroom> <your-name>
For example:
$ im_sender 127.0.0.1:5672 "OpenAMQ discussion" "Baron Bartholomaeus von Saburg-Fridetzki"
There can be any number of clients connected to the same chatroom. There's no need to create chatrooms explicitly; these are created on demand.
License
BSD
Support
Address all questions and comments to moc.xitami|kirtsus#moc.xitami|kirtsus.
Download
Following example uses single exchange ("amq.direct") to pass messages. Chatroom is identified by "routing key":
Following example uses separate exchanges of "fanout" type for individual chatrooms:

The im_sender.c program loops if you press Ctrl-C. It's trivial to fix; add these lines after the fgets statement:
The Ctrl-C won't break the program out of the fgets function call, but by checking if the connection has been killed, the program can exit properly when the user press Enter.
For more, see http://wiki.openamq.org/tutorial:handling-ctrl-c-in-applications.
Ok, the examples are fixed in the proposed way,
I've added im_sender2.c and im_receiver2.c to demonstrate how different exchanges can be used to pass different data flows (chatrooms) instead of using routing keys.