forked from rt106/rt106-algorithm-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestSendRequest.py
40 lines (36 loc) · 1.24 KB
/
testSendRequest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Copyright (c) General Electric Company, 2017. All rights reserved.
import pika, json
from rt106SpecificAdaptorCode import *
messageBody = {
"header":
{
"messageId":"4a29b700-536c-11e6-b9eb-97e10e9139f4",
"executionId":"187ca59b-efce-4b49-abf4-1866aacdc6a3",
"creationTime":1469563524692
},
"analyticId":
{
"name":analytic_name_string,
"version":analytic_version_string
},
"context":[
{
"input":{"value":"pat002/studyB/breast_G13-0056_series13_PURE","type":"String"}
}
]
}
messageHeader = {
"deliveryMode":2,
"content_type":"application/json",
"reply_to":"ccffffc172d18d0d1",
"correlation_id":"187ca59b-efce-4b49-abf4-1866aacdc6a3"
}
connection = pika.BlockingConnection(pika.ConnectionParameters (host='localhost'))
channel = connection.channel()
channel.queue_declare(queue=analytic_queue_string)
channel.basic_publish(exchange='',
routing_key=analytic_queue_string,
body=json.dumps(messageBody),
properties=pika.BasicProperties(reply_to='responeQueueName'))
print(" [x] Sent " + json.dumps(messageBody))
connection.close()