Sample on AMQP

Hi Allard,

I have gone through your videos,it is pretty good concept and thanks for providing such a good framework. Our architecture team has decided to use this framework for one of our project.

I need to work on a POC, Integrate of Axon with Active Mq/Websphere Mq for publishing/subscribing the events where subscriber might be in a different machine.

if you could share any working sample it would be great.

I saw there is no sample available in net with the proper configuration.

Regards,
Naresh

Hi Naresh,

will you be using AMQP or JMS? For AMQP in combination with Spring, there is the SpringAMQPTerminal you can use. It must be configured on the Event Bus. There is an example in the documentation: http://www.axonframework.org/docs/2.3/event-processing.html#d5e1772

If you want to use JMS or AMQP without Spring, then you should implement your own EventBusTerminal.

I don’t have any working samples “on the shelf” that I may share, unfortunately. But in the end, it’s not really that complex. You want messages published on the Event Bus to be sent to an Exchange, and each Cluster (of event listeners) must listen to a Queue that has been bound to that exchange.

Cheers,

Allard

Hi Naresh,

Not sure what you’re looking for but if you’re looking for an example using a distributed event bus with RabbitMQ and a distributed command bus using JGroups you could check out our project, Motown. It’s probably not the cleanest example as it isn’t intended to demonstrate Axon but demonstrate our project. It might be sufficient as it is a working example (not intended for production, just a simple sample).

It’s a sample of a distributed Axon setup using Java, Maven and Spring with XML configs. You can find it here: https://github.com/motown-io/motown/tree/develop/samples/configuration-distributed

Good luck with your POC!

Regards,

Dennis

Hi,

I just realized that there must be a test to prove the components work. Perhaps that can help you get started:

Configuration:
https://github.com/AxonFramework/AxonFramework/blob/master/amqp/src/test/resources/META-INF/spring/messaging-context.xml

The unit test:
https://github.com/AxonFramework/AxonFramework/blob/master/amqp/src/test/java/org/axonframework/eventhandling/amqp/spring/AMQPTerminalTest.java

Good luck.
Cheers,

Allard

Thanks Allard and Dennis.

Now it is clear for me after seeing some of the samples which you have suggested/provided.

Just have one small doubt, if we use FileBased event store, how can i read/parse this event information to display for the user incase uwser wants to know all the events occurred?
Do i need to write a file reader to which can understand the event file …? or axon provides a way to read the file and get the information in a proper format…?

Regards.
Naresh.

Naresh,

I don’t think something is provided for you in Axon to do this. As you’re working on a POC you might be able to go for the “hacky” solution and just read the file directly from Java or add an event listener which duplicates the events in a read model.

It’s pretty easy to set up a “proper” event store though so it might be better to just do that and have a full fledged implementation.

Regards,

Dennis

Hi Naresh,

if you want to show “what happened” in the UI, approach this as anything else you wish to show in the UI: create a read model for it. Unless, of course, you wish to create technical screen. In that case, you can use use the EventStore API to retrieve events. If it’s something for end-users and has to be friendly, create an event handler that appends an entry to some log for each event that passes by.

Cheers,

Allard