def produce(url, ident):
 ctx = zmq.Context.instance()
 s = ctx.socket(zmq.PUSH)
 s.connect(url)
 print(('Producing %s' % ident))
 for i in range(MSGS):
  s.send((u'%s: %i' % (ident, time.time())).encode('utf8'))
  time.sleep(1)
 print(('Producer %s done' % ident))
 s.close()

def produce ( url , ident ) : ctx = zmq . Context . instance ( ) s = ctx . socket ( zmq . PUSH ) s . connect ( url ) print ( ( 'Producing %s' % ident ) ) for i in range ( MSGS ) : s . send ( ( u'%s: %i' % ( ident , time . time ( ) ) ) . encode ( 'utf8' ) ) time . sleep ( 1 ) print ( ( 'Producer %s done' % ident ) ) s . close ( )
produce messages .