bra_fsn_hu

hornetq stomp send

Sep 11th, 2013
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. import logging
  2. logging.basicConfig()
  3. #logging.getLogger().setLevel(logging.DEBUG)
  4. import stomp
  5. import random
  6. import os
  7.  
  8. conn = stomp.Connection(host_and_ports=[('localhost',61613)],
  9.                         version='1.1',
  10.                         heartbeats=(1000, 3000),
  11.                         user='radius_producer',
  12.                         passcode='pass',
  13.                         )
  14. conn.start()
  15. conn.connect()
  16.  
  17. for cnt in range(1000000):
  18.     reclen=random.randint(160,300)
  19.     system='wired'
  20.     status_type=random.choice(['START','INTERIM_UPDATE','STOP'])
  21.     realm='online'
  22.     data=os.urandom(reclen)
  23.     conn.send(data,
  24.               destination='jms.topic.radius',
  25.               #destination='/topic/radius',
  26.               headers={
  27.                        'content-length':reclen,
  28.                        'persistent':'true',
  29.                        'Xsystem':system,
  30.                        'Xstatustype':status_type,
  31.                        'Xrealm':realm
  32.                      },
  33.               )
  34.     print cnt
Advertisement
Add Comment
Please, Sign In to add comment