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 Amazon Simple Notification Service topic. Then your integrations only need to add a subscriber to that topic in form of Amazon Simple Queue Service queue, AWS Lambda functions, or HTTP endpoints.

Configuration options

For each of your integrations, we can setup Snitch in two different ways depending on your needs and preferences:

  1. To publish to an Amazon SNS topic that you own. In this setup, you’ll configure and manage the SNS topic that Snitch publishes to, and this will give you total control over how you consume the events (e.g., email, SQS queues, Lambda functions…).

  2. To publish to an Amazon SQS queue that we’ll configure for you. In this setup, you won’t care about configuring or managing SNS topics or SQS queues in AWS; you only need to consume the events from an SQS queue using AWS APIs and SDKs.

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 SNS topic. Depending on your configuration, you’ll need to grant us publishing rights to your SNS topic, or we will provide you with an SQS queue endpoint - and secure credentials - where your integration can start receiving messages from the queue as the default subscriber type. Please liase with your BeBanjo Technical Account Manager (TAM) to have Snitch setup to your needs.

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 that Snitch publishes 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

When using SQS to consume events, the messages follow a simple lifecycle to ensure 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 SNS topic that by default has an SQS queue subscribed to it.
  • 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 integration processes the message successfully and then deletes it from the queue, so no one else processes it. If this system fails to process the message, then it becomes available again as soon as the visibility timeout passes.

Last updated October 19th, 2018.