This is a decorator function. This decorator can use for only instanse methods of the classes which use Follower metaclass.
Parameters: |
|
---|
See also
class Follower, function following_function()
This is a decorator function. This decorator can use for only class methods, static methods, functions. if you want to use for instance methods, use following() instead of this function.
Parameters: |
|
---|
See also
function following_function()
This is a decorator function. The decorated function is called, automatically sends message.
@auto_twitter("function")
def sample_function():
... do something
If this function is called, function:entry message will be sent before running function, and then function:exit message will be sent after running function.
Use entry, exit parameter for controlling message.
entry | exit | action |
---|---|---|
False | False | send both. |
False | True | exit message only |
True | False | entry message only |
True | True | send both. |
Parameters: |
|
---|
Send message like twitter() method. This function has callback identifer. All receivers call back to this Identifier.
Note
This is planning feature. It isn’t implemented yet.
Send message to other node. This function supports type02, type03 client/server style inter-process communication.
Parameters: |
|
---|
Normally, you don’t have to call receive functions. They are used in type03 inter-process communication context.
If you want to use style01 inter-process communication feature, call this function first.
New in version 0.2.
Connect to other node in style01.
Parameter: | addr (tuple) – tuple which contains hostname and port number |
---|
New in version 0.2.
Connect to other node in style02.
Parameter: | addr (tuple) – tuple which contains hostname and port number |
---|
New in version 0.2.
Connect to other node in style03. Identifier is a filter of queue input.
Parameters: |
|
---|
New in version 0.2.
Send message to other nodes. If you use interconnect() to connect, you don’t have to this method(forward twitter automatically).
New in version 0.2.
Returns: | message |
---|---|
Return type: | Message |
New in version 0.2.
Returns: | message |
---|---|
Return type: | Message |
New in version 0.2.
Close connection.
Parameter: | addr (tuple) – tuple which contains hostname and port number |
---|
New in version 0.2.
If you want to use the method as receiver, set this class as metaclass.
In python 2.4 - 2.6:
# Python 2.4, 2.5, 2.6
class Logger(object):
__metaclass__ = Follower
@following("*:log")
def receive_log(self, message):
...
In python 3.0 -:
# Python 3.0, 3.1
class Logger(metaclass=Follower):
@following("*:log")
def receive_log(self, message):
...
If you use Ruby, This class provide special decorators. following() and auto_twitter(). Use like this:
# Ruby
class Logger
include BerryMQ::Follower
following("*:log")
def receive_log(message)
...
end
end
This object is created in berryMQ automatically. User doesn’t create this object directly.
All of following attributes are readonly(defined as property).
This is a key class of pull API for message receiving.
queue = berrymq.Queue("task:*")
# wait until someone send "task:*" message
message = queue.get()
Method name of this class is similar to Python’s standard library. This class doesn’t have put() method, because of all stored items are sent by berryMQ. User uses this object just as message receiver.
Create new method queue.
If you pass True at shared flag, new object become a shared queue. If there are some objects which has same Identifier, they share only one queue. If some object get() value, others can’t get that message any more.
In another case, new object become a standalone queue. If there are some objects which has same Identifier and someone send message which matches that identifier, all queues will store a copy of that message.
Parameter: | identifier – works as a filter. see Identifier. |
---|
Return True if the queue object is empty.
If you use this class in concurrency envirionment, this result is not reliable because other thread put new value after calling this method.
Return stored message. This is a FIFO queue.
If block is True (defalut), function call is blocked while new message received. If False it returns immediately even if the queue is empty.
Parameters: |
|
---|---|
Returns: | stored Message object |
Note
Future release supports priority queue.
New in version 0.2.
This is a adapter class for Growl. You can forward message to Growl. This class uses UDP protocol of Growl.
Note
Future release will support Growl Notification Transfer Protocol(GNTP). It supports call back mechanism.
New in version 0.3.
This is a adapter class for observing file system. This adapter can notify following change:
sample:
observer = berrymq.adapter.fileobserver.FileObserver("~/log/*.log", "local_log")
If new log file is created, this object twitters local_log:created message automatically. Anyone modify log files, local_log:modified will be sent. Of course, local_log:removed message will be sent if any file is removed.
Parameters: |
|
---|
New in version 0.3.
This is a simple intarval timer. Following adapter sends timer:tick message every 10 seconds.
timer = berrymq.adapter.timer.IntervalTimer("timer", 10)
Parameters: |
|
---|
New in version 0.3.
This class convert berryMQ message into wxPython’s event.
Parameters: |
|
---|