Skip to content

Commit

Permalink
more doc
Browse files Browse the repository at this point in the history
  • Loading branch information
jldupont committed Mar 3, 2013
1 parent c6399d3 commit 3ac776d
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 4 deletions.
31 changes: 29 additions & 2 deletions README.md
@@ -1,20 +1,47 @@
For more information, visit http://www.systemical.com/doc/opensource/pysubpub

Overview
========

This package offers a "publish-subscribe" framework.

The framework can be used to implement basic "actors" where each "actor" is contained in a python module.
The function "upub" can be used to queue a message in front instead of the normal tail.

Small Example
=============

## Actor 1 in module1.py
##
from subpub import sub, pub

@sub
def on_topic1(param1):
print "topic1: ", param1
print "module1/topic1: ", param1

@sub
def on_topic2(param1):
print "module1/topic2: ", param1
pub("topic", "value1")

## Actor 2 in module2.py
##
from subpub import sub, pub

@sub
def on_topic1(param1):
print "module2/topic1: ", param1
pub("topic1", "value1")
pub("topic2", "value2")


The example above would yield:

"module1/topic1: value1"
"module2/topic1: value1"
"module1/topic2: value2"


History
=======
Expand Down
29 changes: 27 additions & 2 deletions setup.py
Expand Up @@ -18,18 +18,43 @@
This package offers a "publish-subscribe" framework.
The framework can be used to implement basic "actors" where each "actor" is contained in a python module.
The function "upub" can be used to queue a message in front instead of the normal tail.
Small Example
=============
## Actor 1 in module1.py
##
from subpub import sub, pub
@sub
def on_topic1(param1):
print "topic1: ", param1
print "module1/topic1: ", param1
@sub
def on_topic2(param1):
print "module1/topic2: ", param1
pub("topic", "value1")
## Actor 2 in module2.py
##
from subpub import sub, pub
@sub
def on_topic1(param1):
print "module2/topic1: ", param1
pub("topic1", "value1")
pub("topic2", "value2")
The example above would yield:
"module1/topic1: value1"
"module2/topic1: value1"
"module1/topic2: value2"
"""

setup(name= 'pysubpub',
Expand Down

0 comments on commit 3ac776d

Please sign in to comment.