Index
- Intro
- Some prep
- References
- Messages
- Subscriber
- Publisher
- Configuration
- Others
- Final gift
Intro
JustSaying is a light-weight service bus on top of AWS (nugget) created by the guys from JustEat. It is used to communicate with AWS queues. You can subscribe to a queue or publish into SNS (push notifications) in just a few lines of code.Some prep
To start working with AWS I recommend you to install the AWS developer tools and configure it with your credentials. These are defined in AWS as a token and a secret key. You can place these credentials in your app/web.config file, system environmental variables, in your console, in a file defined in a particular folder or even in your machine.config file.Messages
This entities represent the unit of work (POCO) for JustSaying. You can define your own entities inheriting the Message class as displayed here:Subscriber
Now let's subscribe to a queue. This is step and the publish registration can be done in the same place in your application.Publisher
Now it's time to tell JustSaying which messages we want to publish. The topic is defined in the message name:Configuration
At this step, we can define how our handlers will manage the messages from the queues. In this example, we keep message to the default life time, 1 minute. After that time, if no handler take care of the message, it will be throw away (not really, it will be keep in an 'error' queue). We are telling 'OrderFailed' to keep messages for 5 min. and not handle them again on failure for 60 seconds.
Others
There are more stuff we can configure here, for example we can define a throttling mechanism to define a limit in the way JustSaying processed messages.
By default, error when handling messages are stored in separate queues, typically named the same
with a "-error" suffix. You can opt out this configuration if you don't want to take care of those errors.
In case you want to intercept any error from the handler when processing messages you can pass an Action into the "OnError" event within the ConfigureSubscriptionWith() fluent method:
Final gift
Finally, before leaving you in peace, I have a present for you with the following post from Just Eat technology blog:http://tech.just-eat.com/2014/07/24/opensourced-justsaying-aws-messagebus/
Enjoy and keep coding!
References
http://www.just-eat.com/https://github.com/justeat/JustSaying
https://www.nuget.org/packages/JustSaying/
0 comments:
Post a Comment