We use cookies (just for analytics) on this website. If you continue we will assume you are happy with it. ok

BeBanjo

Back to index

Introduction to Snitch

To track changes in any resource (title, metadata, etc.), you can use the Movida Events feed and Sequence Events feed. We often recommend you develop events-driven integrations that:

  • regularly poll the Movida Events feed and / or Sequence Events feed;
  • filtered by event-type to obtain only the events you’re interested in;
  • and using the parameter newer_than to obtain only the new events having occurred since your last request.

But in those cases when you need to build several integrations, performing several poll requests from multiple components may be inefficient. So we have developed a service that takes care of it for you, and we call this service Snitch.

Snitch delivers the kind of events that your integrations need to an AWS Simple Queue Service. Then your integrations only need to consume messages from these queues.

Amazon Simple Queue Service

Amazon Simple Queue Service (SQS) is a fully-managed message queuing service for reliably communicating among distributed software components and microservices.

SQS makes it simple and cost-effective to decouple and coordinate the components of a cloud application. Using SQS, you can send, store, and receive messages between software components at any volume, without losing messages or requiring other services to be always available. SQS standard queues offer maximum throughput, best-effort ordering, and at-least-once delivery.

How it works

During the initial setup of Snitch, you will specify which events (or all of them) from Movida and/or Sequence that should be configured for delivery into an SQS queue. Please liase with your BeBanjo Technical Account Manager (TAM) to have Snitch setup to your needs. The BeBanjo TAM will provide you with an SQS queue endpoint - and secure credentials - where your integration can start receiving messages from the queue.

We recommend using the AWS SDK to consume messages from the queue. The SDK is available for multiple languages: Java, .NET, Node.js, Ruby, Python, Go, and more.

Payload

Each message in SQS corresponds to an Event that has happened in Movida or Sequence. The content of the messages is the same as a Movida API Event or Sequence API Event, with the difference that it is in JSON format.

{
  "id":11111111,
  "event_type":"scheduling_deleted",
  "timestamp":"2017-03-16T16:10:37.000+00:00",
  "changes":[],
  "subject":"https://movida.example.com/api/schedulings/4086082"
}
  • id: Event ID.
  • event_type: The type of the event.
  • timestamp: The date and time when the event occurred.
  • changes: List of attributes and links that changed. Only present in update events.
  • subject: The resource created, updated or deleted.

Message Lifecycle

The messages stored in SQS have an easy lifecycle that ensures that all messages are processed.

  • A new event happens in Movida or Sequence.
  • Snitch filters the events and publishes a new message for that event to the queue.
  • An integration performs a call to the queue, sees the pending message and retrieves it.
  • When the message is retrieved, the message becomes locked meaning that is not available for any other consumer that can read from the same queue.
  • The integrations process the message successfully and delete the message from the queue, so no one else processes it. If this system fails to process the message, then it will become available by another consumer (or the same consumer) as soon as the visibility timeout passes.

Last updated October 10th, 2017.