Skip to content

Commit

Permalink
Add expiration time in mock connector
Browse files Browse the repository at this point in the history
This patch adds an expiration time of 10 seconds per message in script
mock connector.
  • Loading branch information
ramonhpr authored and vitbaq committed Dec 26, 2019
1 parent 01a0a48 commit 5410478
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/mock-connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

QUEUE_CLOUD_NAME = 'connIn-messages'

MESSAGE_EXPIRATION_TIME_MS = '10000'

EVENT_REGISTER = 'device.register'
KEY_REGISTERED = 'device.registered'

Expand Down Expand Up @@ -170,12 +172,18 @@ def msg_update(args):
channel = __amqp_start()
msg = __parse_update_message(args.json_msg_file)
channel.basic_publish(exchange=fog_exchange,
properties=pika.BasicProperties(
expiration=MESSAGE_EXPIRATION_TIME_MS,
),
routing_key=KEY_UPDATE, body=msg)

def msg_request(args):
channel = __amqp_start()
msg = __parse_request_message(args.json_msg_file)
channel.basic_publish(exchange=fog_exchange,
properties=pika.BasicProperties(
expiration=MESSAGE_EXPIRATION_TIME_MS,
),
routing_key=KEY_REQUEST, body=msg)

def no_command(args):
Expand Down

0 comments on commit 5410478

Please sign in to comment.