Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rfleming71/junglebus
Transactional service bus built on top of Amazon Web Services
https://github.com/rfleming71/junglebus
amazon-web-services aws sns sqs
Last synced: 22 days ago
JSON representation
Transactional service bus built on top of Amazon Web Services
- Host: GitHub
- URL: https://github.com/rfleming71/junglebus
- Owner: rfleming71
- License: mit
- Created: 2016-07-01T20:59:04.000Z (over 8 years ago)
- Default Branch: development
- Last Pushed: 2017-10-05T15:58:30.000Z (about 7 years ago)
- Last Synced: 2024-11-19T23:27:38.879Z (about 1 month ago)
- Topics: amazon-web-services, aws, sns, sqs
- Language: C#
- Homepage:
- Size: 280 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JungleBus
Transactional service bus built on top of Amazon Web Services.
[![Build status](https://ci.appveyor.com/api/projects/status/ccy923lmviskyfww/branch/master?svg=true)](https://ci.appveyor.com/project/rfleming71/junglebus/branch/development)
Since version 3.0, the bus is built upon the JungleQueue library.# Creating the Bus
Creates a service bus that can send and recieve messages
```C#
var bus = BusBuilder.Create("Development")
.WithObjectBuilder(new JungleQueue.StructureMap.StructureMapObjectBuilder())
.UsingJsonSerialization()
.PublishingMessages(typeof(TestMessage).Assembly.ExportedTypes, RegionEndpoint.USEast1)
.SetInputQueue("Test_Queue1", RegionEndpoint.USEast1)
.SetSqsPollWaitTime(14)
.UsingEventHandlersFromEntryAssembly()
.SetNumberOfPollingInstances(2)
.CreateStartableBus();bus.StartReceiving();
bus.CreateSendBus().Publish(new TestMessage());
```#Example message handler
```C#
public class Handler2 : IHandleMessage
{
private readonly IBus _bus;
private readonly ILog _log;
public Handler2(IBus bus, ILog log)
{
_bus = bus;
_log = log;
}public void Handle(TestMessage message)
{
_log.Info("Starting message Handler 2");
_bus.Publish(new TestMessage2()); // Publish event to the world
_bus.PublishLocal(new TestMessage3())); // Publish event to self
_log.Info("Finished message Handler 2");
}
}
```# Other bus types
## Send Only Bus
Creates a service bus that can only send messages
```C#
var busBuilder = BusBuilder.Create()
.WithStructureMapObjectBuilder()
.UsingJsonSerialization()
.PublishingMessages(typeof(TestMessage).Assembly.ExportedTypes, RegionEndpoint.USEast1)
.CreateSendOnlyBusFactory();
busBuilder().Publish(new TestMessage());
```## Receive Only Bus
Creates a service bus that can only receive messages. This bus can send messages to itself.
```C#
var bus = BusBuilder.Create()
.WithObjectBuilder(new JungleQueue.StructureMap.StructureMapObjectBuilder())
.UsingJsonSerialization()
.SetInputQueue("Test_Queue1", RegionEndpoint.USEast1)
.SetSqsPollWaitTime(14)
.UsingEventHandlersFromEntryAssembly()
.SetNumberOfPollingInstances(2)
.PublishingLocalEventsOnly()
.CreateStartableBus();
bus.StartReceiving();
```