Skip to main content

Send and receive messages without thinking about it

Project description


Send messages without really thinking about it.


Use pip to install the latest stable version:

pip install morp

To install the development version:

pip install -U "git+"

1 Minute Getting Started

Send and receive a Foo message.

First, let's set our environment variable to use the dropfile (local files suitable for development and prototyping) interface:

export MORP_DSN=dropfile:///${TMPDIR}

Second, let's create a Foo Message class:

from morp import Message

class Foo(Message):
    def target(self):
        # this will be run when a Foo message is consumed

Third, let's start our message consumer in a shell:

$ morp

Fourth, let's send a message:

f = Foo()
f.some_field = 1
f.some_other_field = 2

That's it!


You configure your connection using a dsn in the form:


So, to connect to Amazon SQS, you would do:


You can also override some default values like region and read_lock:



If you would like to encrypt all your messages, you can pass in a key argument to your dsn and Morp will take care of encrypting and decrypting the messages for you transparently.

Let's just modify our dsn to pass in our key:


That's it, every message will now be encrypted on send and decrypted on receive. If you're using SQS you can also use Amazon's key management service to handle the encryption for you.

Environment configuration


By default every message will be sent, if you just want to test functionality without actually sending the message you can set this environment variable to turn off all the queues.

MORP_DISABLED = 1 # queue is off
MORP_DISABLED = 0 # queue is on


If you would like to have your queue names prefixed with something (eg, prod or dev) then you can set this environment variable and it will be prefixed to the queue name.


Set this environment variable with your connection dsn so morp can automatically configure itself when the interface is first requested.


I would like to have multiple queues

By default, Morp will send any message from any morp.Message derived class to Message.get_name(), you can override this behavior by giving your child class a .name attribute:

from morp import Message

class childMsg(Message):
    name = "custom-queue-name"

Now, you can have the Morp command line consumer read from that queue instead:

$ morp custom-queue-name

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

morp-5.2.2.tar.gz (20.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page