messaging package

Submodules

messaging.apps module

Defines the application configuration for the scale messaging application

class messaging.apps.MessagingConfig(app_name, app_module)

Bases: django.apps.config.AppConfig

Configuration for the messaging app

label = u'Messaging'
name = u'messaging'
ready()
verbose_name = u'Message passing'

messaging.exceptions module

exception messaging.exceptions.CommandMessageExecuteFailure

Bases: exceptions.Exception

Exception indicating a failure signaled by execute function of CommandMessage

exception messaging.exceptions.InvalidCommandMessage

Bases: exceptions.Exception

Exception indicating an invalid message identified during message processing

messaging.manager module

class messaging.manager.CommandMessageManager

Bases: object

get_queue_size()

Gets the current length of the queue

Returns:number of messages in the queue
Return type:int
receive_messages()

Main entry point to message processing.

This will process up to a batch of 10 messages at a time. Behavior may differ slightly based on message backend. RabbitMQ will immediately iterate over up to 10 messages, process and return. SQS will long-poll up to 20 seconds or until 10 messages have been processed, process and then return.

New messages will potentially be sent within this method, if CommandMessage populates the new_messages list.

send_messages(commands)

Serialize CommandMessages and send via configured message broker

The command.to_json() and command.message_type will be used to generate serialized form of CommandMessage for transmission across the wire.

Parameters:command ([messaging.messages.message.CommandMessage]) – CommandMessages to be sent via configured broker

Module contents