Skip to content

Instantly share code, notes, and snippets.

@oldpatricka
Created June 20, 2012 15:39
Show Gist options
  • Save oldpatricka/2960548 to your computer and use it in GitHub Desktop.
Save oldpatricka/2960548 to your computer and use it in GitHub Desktop.
Pyon.net example
from pyon.net.endpoint import RPCClient
from pyon.net.messaging import make_node
connection_params = {
'host': 'localhost',
'username': 'guest',
'password': 'guest',
'vhost': '/',
'port': 5672,
'heartbeat': 30
}
n, io = make_node(connection_params=connection_params)
icfg = {'interceptors': {
'encode': {'class': 'pyon.core.interceptor.encode.EncodeInterceptor'}},
'stack': {'message_incoming': ['encode'],
'message_outgoing': ['encode']}}
n.setup_interceptors(icfg)
rpcc = RPCClient(node=n, to_name=('ion_bandersnatch_local', 'process_dispatcher'))
message = {
'process_definition': {
'executable': {
'class': 'TestProcess',
'module': 'ion.services.cei.test.test_process_dispatcher'
},
'lcstate': 'DRAFT_PRIVATE',
'definition_type': 1,
'description': '',
'ts_updated': '',
'type_': 'ProcessDefinition',
'version': '',
'arguments': [],
'ts_created': '',
'name': 'fake_test_process'
}
}
print rpcc.request(message, op='create_process_definition')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment