Skip to content

A minimal PubSub based distributed message queue model with multiple backend persistence modes - InMemory, SQLite, MySQL, MongoDB.

License

Notifications You must be signed in to change notification settings

jyotiska/minpubsub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minpubsub

A minimal PubSub based distributed message queue model with multiple backend persistence modes - SQLite, MySQL, MongoDB.

Usage

Create a pubsub object:

>> from minpubsub import create
>> pubsub = create('memory') # for in-memory message queue
>> pubsub = create('sqlite') # for sqlite based message queue
>> pubsub = create('sqlite', '<directory>', '<db_name>') # for sqlite based message queue, you can optionally also specify a directory and the database name
>> pubsub = create('mysql', '<host>', '<username>', '<password>', '<schema>') # for mysql based message queue
>> pubsub = create('mongodb', '<host>', '<port>') # for mongodb based message queue

Subscribe to a Topic:

>> subscriber = pubsub.subscribe('topic') # for subscribing to a single topic
>> subscriber = pubsub.subscribe('topic_1', 'topic_2', 'topic_3') # for subscribing to multiple topics

Publish a message to a topic:

>> pubsub.publish('topic_1', 'hello world!')

Retrieve a message from the message queue:

>> subscriber.getNext()

Retrieve all messages from the message queue:

>> subscriber.getAll()

Retrieve number of messages available in the message queue:

>> subscriber.getCount()

Stop listening to a Topic (not available for in-memory message queue)

>> subscriber.closeTopic('<topic_name>')

minpubsub is an experimental project and a work in progress. It is not yet ready to be used in production environment.

Supported backends

  • memory
  • sqlite
  • mysql
  • mongodb

About

A minimal PubSub based distributed message queue model with multiple backend persistence modes - InMemory, SQLite, MySQL, MongoDB.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages