Created
June 20, 2012 15:39
-
-
Save oldpatricka/2960548 to your computer and use it in GitHub Desktop.
Pyon.net example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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