def run(self, _): client = Stomp(self.config) yield client.connect() client.add(ReceiptListener(1.0)) for j in range(10): yield client.send(self.QUEUE, json.dumps({'count': j}).encode(), receipt='message-%d' % j) client.disconnect(receipt='bye') yield client.disconnected # graceful disconnect: waits until all receipts have arrived
def run(self, _): bt = clock() client = Stomp(self.config) yield client.connect() client.add(ReceiptListener(1.0)) for i in range(200000): yield client.send(self.QUEUE, "hello world qwertyuiopasdfghjklzxcvbnm") client.disconnect() et = clock() print et - bt yield client.disconnected
def run(self, _): client = Stomp(self.config) yield client.connect() client.add(ReceiptListener(1.0)) for j in range(10): yield client.send(self.QUEUE, json.dumps({ 'count': j }).encode(), receipt='message-%d' % j) client.disconnect(receipt='bye') yield client.disconnected # graceful disconnect: waits until all receipts have arrived
def run(self): # client = yield Stomp(self.CONFIG[pathwayProcessor.CONFIG]).connect() client = Stomp(self.config) yield client.connect() headers = { # client-individual mode is necessary for concurrent processing # (requires ActiveMQ >= 5.2) StompSpec.ACK_HEADER: StompSpec.ACK_CLIENT_INDIVIDUAL, # the maximal number of messages the broker will let you work on at the same time 'activemq.prefetchSize': '100', } # client.subscribe(self.CONFIG[pathwayProcessor.NAME], headers, listener=self) client.subscribe(self.QUEUE, headers, listener=SubscriptionListener(self.consume, errorDestination=self.ERROR_QUEUE)) client.add(listener=self)
def run(self): ''' Initializes the stompest async client ''' queue_url = self.config['queue']['url'] queue_name = self.config['queue']['name'] error_queue_name = self.config['queue']['error_name'] client = Stomp(StompConfig(queue_url)) yield client.connect() client.subscribe( queue_name, # must begin with leading slash (eg: /queue/) headers={StompSpec.ACK_HEADER: StompSpec.ACK_CLIENT_INDIVIDUAL}, listener=SubscriptionListener( self.consume, errorDestination=error_queue_name ) ) client.add(self)
def run(self, _): client = Stomp(self.config) yield client.connect() client.add(ReceiptListener(1.0)) dd8 = [ { 'insureCarId': 3797, 'firstRegister': u'', 'cityCode': '32010000', 'vinNo': u'LVBV6PDC7AH017644', 'plateNumber': u'苏A90198', 'vehicleBrand': u'', 'companyId': ['12'], 'licenseType': '01', 'custName': u'\u9648\u7fe0\u7ea2', 'insuranceType': [ { u'carDamageBenchMarkPremium': u'1', # 车损险不计免赔 u'carDamagePremium': u'1', # 车损险 u'driverDutyPremium': { u'Amount': u'10000', u'isCheck': u'0' }, # 车上人员险(司机) u'driverDutyBenchMarkPremium': u'0', # 车上人员险(司机)不计免赔 u'passengerDutyPremium': { u'Amount': u'10000', u'isCheck': u'0' }, # 车上人员险(乘客) u'passengerBenchMarkPremium': u'0', # 车上人员险(乘客)不计免赔 u'carFirePremium': u'0', # 自燃险 u'carFireBrokenBenchMarkPremium': u'0', # 自燃险不计免赔 u'carTheftPremium': u'0', # 盗抢险 u'carTheftBenchMarkPremium': u'0', # 盗抢险不计免赔 u'otherHurtPremium': { u'Amount': u'1000000', u'isCheck': u'1' }, # 三者险 u'otherHurtBenchMarkPremium': u'1', # 三者险不计免赔 u'engineWadingPremium': u'0', # 涉水险 u'engineWadingBenchMarkPremium': u'0', # 涉水险不计免赔 u'carNickPremium': { u'Amount': u'2000', u'isCheck': u'0' }, # 划痕险 u'carNickBenchMarkPremium': u'0', # 划痕险不计免赔 u'nAggTax': u'1', u'insuranceTypeGroupId': u'183', u'glassBrokenPremium': u'0', # 玻璃破碎险 u'compulsoryInsurance': u'1', u'insuranceTypeGroup': u'1_11_110_12_2_20_3_30_4_5_50_6_8_20000_80_9' }, ], 'sessionId': u'2bbcd99cd95d9b8fdf98b29e163686f6bca30736', 'engineNo': u'0651004', 'NSeatNum': u'5', 'identitCard': u'320121197607280023', 'endDate': u'2017-04-7', 'isPhone': u'1' }, ] # yield client.send('/queue/COMPLETE_PLATE_NUMBER', json.dumps(dd8).encode()) # yield client.send('/queue/BATCH_ANCHENG_QUEUE', json.dumps(dd8).encode()) yield client.send('/queue/REAL_TIME_QUEUE', json.dumps(dd8).encode()) # yield client.send('/queue/BATCH_ANCHENG_QUEUE', json.dumps(dd8).encode()) # yield client.send('/queue/BATCH_PROCESS_QUEUE', json.dumps(dd8).encode()) client.disconnect() yield client.disconnected # graceful disconnect: waits until all receipts have arrived