Core API¶
-
class
lymph.core.container.
ServiceContainer
¶ -
classmethod
from_config
(config, **kwargs)¶
-
start
()¶
-
stop
()¶
-
send_message
(address, msg)¶ Parameters: - address – the address for this message; either a ZeroMQ endpoint a service name
- msg – the
lymph.core.messages.Message
object that will be sent
Returns:
-
lookup
(address)¶ Parameters: address – an lymph address Returns: lymph.core.services.Service
orlymph.core.services.ServiceInstance
-
classmethod
-
class
lymph.core.channels.
ReplyChannel
¶ -
reply
(body)¶ Parameters: body – a JSON serializable data structure
-
ack
()¶ acknowledges the request message
-
-
class
lymph.core.channels.
RequestChannel
¶ -
get
(timeout=1)¶ Returns: lymph.core.messages.Message
returns the next reply message from this channel. Blocks until the reply is available. Raises
Timeout
aftertimeout
seconds.
-
-
class
lymph.core.events.
Event
¶ -
type
¶ the event type / name
-
body
¶ dictionary with the payload of the message
-
source
¶ id of the event source service
-
__getitem__
(name)¶ gets an event parameter from the body
-
-
class
lymph.core.services.
Service
¶ Normally created by
ServiceContainer.lookup()
. Service objects represent lymph services.-
__len__
()¶ Returns the number of known instances of this service.
-
-
class
lymph.core.services.
ServiceInstance
¶ Describes a single service instance. Normally created by
ServiceContainer.lookup()
-
identity
¶ The identity string of this service instance
-
endpoint
¶ The rpc endpoint for this
-
-
class
lymph.core.connections.
Connection
¶ You can attain a connection to an lymph service instance directly from
lymph.core.container.ServiceContainer.connect()
, or from the higher-level API inlymph.core.services
. For ZeroMQ endpoint addresses the following to statements are roughly equivalent:container.connect(address) # only works for tcp://… addresses container.lookup(address).connect() # will also work for service names