Skip to main content

Send and receive messages without thinking about it

Project description

Send messages without really thinking about it. Currently works with Amazon’s SQS.

DSN

You configure your connection using a dsn in the form:

InterfaceName://username:password@?param1=value1&param2=value2

So, to connect to SQS, you would do:

morp.interface.sqs.SQS://AWS_ID:AWS_KEY@

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

morp.interface.sqs.SQS://AWS_ID:AWS_KEY@?region=us-west-1&read_lock=120

If you set the environment variable MORP_DSN with your connection dsn then morp will automatically configure itself on first import.

1 Minute Getting Started

Send and receive a Foo message.

First, let’s set our environment variable:

export MORP_DSN=morp.interface.sqs.SQS://AWS_ID:AWS_KEY@

Second, let’s create a Foo class:

import morp

class Foo(morp.Message):
    pass

Third, let’s get Foo ready to receive messages:

while True:
    with Foo.recv() as foo_msg:
        print foo_msg.fields

Fourth, let’s send a message:

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

And we’re done, you can check out the actual example in the /example folder on Github to see similar code to the above in action.

Installation

Use pip:

pip install morp

License

MIT

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-0.2.7.tar.gz (7.5 kB view details)

Uploaded Source

File details

Details for the file morp-0.2.7.tar.gz.

File metadata

  • Download URL: morp-0.2.7.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for morp-0.2.7.tar.gz
Algorithm Hash digest
SHA256 72d01b55fb0c450c97d2458d29464e2b5420e7e1b9857fe3d79c7b6d03c33c69
MD5 a321db3c2e17aa58b0b661d5b4ea01de
BLAKE2b-256 f875dc6bd7039fe233dffd14f87cc48eb5fd65a063643876989912760de68ee8

See more details on using hashes here.

Supported by

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