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:

lymph.core.channels.ReplyChannel

lookup(address)
Parameters:address – an lymph address
Returns:lymph.core.services.Service or lymph.core.services.ServiceInstance
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 after timeout seconds.

class lymph.core.messages.Message
id
type
subject
body
packed_body
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.

__iter__()

Yields all known instances of this service.

__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 in lymph.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
class lymph.core.interfaces.Proxy(container, address, namespace=None, timeout=1)
__getattr__(self, name)

Returns a callable that will execute the RPC method with the given name.