Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import logging
- logging.basicConfig()
- #logging.getLogger().setLevel(logging.DEBUG)
- import stomp
- import random
- import os
- import time
- random.seed()
- conn = stomp.Connection(host_and_ports=[('localhost',5000)],
- use_ssl=True,
- ssl_key_file = '/usr/local/etc/stunnel/radius-producer.key',
- ssl_cert_file = '/usr/local/etc/stunnel/radius-producer.pem',
- )
- conn.start()
- conn.connect()
- status_types=['START','INTERIM_UPDATE','STOP']
- prevcnt=0
- prevreport=time.time()
- cnt=0
- start=time.time()
- for i in range(20000):
- reclen=random.randint(160,300)
- system='wired'
- status_type=status_types[i%3]
- realm='online'
- data=os.urandom(reclen)
- conn.send(data,
- destination='/topic/VirtualTopic.radius',
- headers={
- 'content-length':reclen,
- 'persistent':'true',
- 'Xsystem':system,
- 'Xstatustype':status_type,
- 'Xrealm':realm,
- },
- )
- if status_type=='STOP' or status_type=='INTERIM_UPDATE':
- cnt+=1
- if time.time()-prevreport>=1:
- print time.time()-start,cnt-prevcnt,cnt
- prevcnt=cnt
- prevreport=time.time()
- print time.time()-start,cnt-prevcnt,cnt
Advertisement
Add Comment
Please, Sign In to add comment