A subscription identifies the subscriber and the hook URL where notifications are POSTed. A resthooks client is identified in the system by a subscriber identifier. This is an arbitrary String. A resthooks client can subscribe to more than one event type. A resthooks client may subscribe only once to an event type.
As soon as an event is received, the resthooks server processes it only if there are subscriptions for that event type.
- The event is received in the TopicExchange specified with the resthooks.exchange variable, with default value of: resthooks.firehose.
- The exchange routes the event to the corresponding Queue.
- The event is delivered to a per ecent type message pre-processor that validates the payload and saves the Event
- The message pre-processor sends the event to a FanOut exchange that in turn broadcasts the Event to a per Subscription EventConsumer
- The EventConsumer has been configure with the corresponding subscription and receives the Event:
- If the Event is valid it continues processing it, otherwise it discards it. Invalid Events are not notified but can be queried.
- The EventConsumer tries to send a POST request, with a link to the Event resource (Skinny Payload), to the callback URL configured in the corresponding subscription
- If the request fails, the EventConsumer retries following the backoff policy configured with the Subscription
The subscriber can request a list of notification attempts
This solution relies in RabbitMQ and MongoDB. You need to configure access to these resoures for the Resthooks module to work.
The following properties should be set, either in the command line as enviroment vairables, JVM arguments, in an application.properties or application.yml files. Please, note the different formats you need to use in each case.
spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
spring.data.mongodb.db=hooks
spring.rabbitmq.host=localhost
spring.rabbitmq.port=5672
By default, we are not using any username or password to connect to rabbitmq. You can override the default values setting these properties:
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest
Additionally you can enable DEBUG or TRACE level logs setting following property to the desired log level: logging.level.com.byteflair=DEBUG
.