Peach :: publisher :: Publisher :: Class Publisher
[hide private]

Class Publisher

source code

The Publisher object(s) implement a way to send and/or receave data by some means. This could be a TCP connection, a filehandle, or SQL, etc.

There are two "types" of publishers, stream based and call based. This base class supports both types.

To support stream based publishing implement everything but "call".

To support call based publishing implement start, stop, and call.

Note: A publisher can support both stream and call based publishing.

Instance Methods [hide private]
 
start(self)
Change state such that send/receave will work.
source code
 
stop(self)
Change state such that send/receave will not work.
source code
 
send(self, data)
Publish some data
source code
string
receive(self, size=None)
Receive some data.
source code
string
call(self, method, args)
Call a method using arguments.
source code
 
property(self, property, value=None)
Get or set property
source code
 
accept(self)
Accept incoming connection.
source code
 
close(self)
Close current stream/connection.
source code
Method Details [hide private]

start(self)

source code 

Change state such that send/receave will work. For Tcp this could be connecting to a remote host

stop(self)

source code 

Change state such that send/receave will not work. For Tcp this could be closing a connection, for a file it might be closing the file handle.

send(self, data)

source code 

Publish some data

Parameters:
  • data (string) - Data to publish

receive(self, size=None)

source code 

Receive some data.

Parameters:
  • size (integer) - Number of bytes to return
Returns: string
data received

call(self, method, args)

source code 

Call a method using arguments.

Parameters:
  • method (string) - Method to call
  • args (Array) - Array of strings as arguments
Returns: string
data returned (if any)

property(self, property, value=None)

source code 

Get or set property

Parameters:
  • property (string) - Name of method to invoke
  • value (object) - Value to set. If None, return property instead

accept(self)

source code 

Accept incoming connection. Blocks until incoming connection occurs.