You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2019/12/09 06:59:29 UTC

[GitHub] [rocketmq-client-python] tinybright edited a comment on issue #78: What should I put in expression ? consumer.subscribe(topic, callback, expression)

tinybright edited a comment on issue #78: What should I put in expression ? consumer.subscribe(topic, callback,expression) 
URL: https://github.com/apache/rocketmq-client-python/issues/78#issuecomment-563092831
 
 
   I tried to reappear it.
   But it went wrong when I tried to send msg by Producer.
   Though I can send Message By rocketmq-console.
   The result is that subscribe go wrong  after I kill the process directly and rerun a consumer by same group_id  and instance_name.
   
   `interval_second = 4
   rocketmq_config = Config.rocketmq
   namesrv = rocketmq_config['namesrv']
   topic = rocketmq_config['topic']
   producer_group_id = rocketmq_config['producer_group_id']
   tags='seed'
   keys='seed'
   producer = Producer(producer_group_id)
   producer.start()
   
   def fetch_id(seed):
       return seed is None and None or str(seed['id'])
   
   def job1():
       seed_list = ["1","2"]
       producer.set_namesrv_addr(namesrv)
       i = 0
       print("tick {0} {1}".format(topic,datetime.datetime.now()))
       for seed in range(4):
   
           i += 1
           msg = Message(topic)
           msg.set_keys('pk{0}'.format(i))
           msg.set_tags('pt{0}'.format(i))
           t = datetime.datetime.now().strftime("%M%S"+"-"+str(i))
           msg.set_body( t)
           ret = producer.send_sync(msg)
           print(t,ret.status, ret.msg_id, ret.offset)
   
   
   def job1_task():
       threading.Thread(target=job1).start()
   
   def run():
       job1_task()
       schedule.every(interval_second).seconds.do(job1_task)
       while True:
           schedule.run_pending()
       producer.shutdown()
   
   run()`
   `Exception in thread Thread-51:
   Traceback (most recent call last):
     File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner
       self.run()
     File "/usr/lib64/python3.6/threading.py", line 864, in run
       self._target(*self._args, **self._kwargs)
     File "gogo_producer1.py", line 47, in job1
       ret = producer.send_sync(msg)
     File "/usr/lib64/python3.6/site-packages/rocketmq/client.py", line 214, in send_sync
       ffi_check(dll.SendMessageSync(self._handle, msg, ctypes.pointer(cres)))
     File "/usr/lib64/python3.6/site-packages/rocketmq/exceptions.py", line 27, in ffi_check
       raise exc_cls(msg)
   rocketmq.exceptions.ProducerSendSyncFailed: No route info of this topic: SpiderSeed,error:-1,in file rocketmq-client-cpp/src/producer/DefaultMQProducer.cpp line:379`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services