private void registerZMQListener(
      EndpointConfig endpointConfig,
      final MessageListener messageListener,
      Bus bus,
      final ZMQ.Context zmqContext) {

    WorkQueueManager queueManager = bus.getExtension(WorkQueueManager.class);
    final Executor executor =
        queueManager.getNamedWorkQueue("zmq-transport") != null
            ? queueManager.getNamedWorkQueue("zmq-transport")
            : queueManager.getAutomaticWorkQueue();
    final ZMQ.Socket zmqSocket = ZMQResourceFactory.createSocket(endpointConfig, zmqContext);
    final ZMQ.Poller poller = ZMQResourceFactory.createPoller(zmqSocket, zmqContext);

    executor.execute(
        new Runnable() {
          @Override
          public void run() {
            boolean isContextTerm = false;

            while (!isContextTerm) {
              poller.poll();

              final byte[] message = ZMQUtils.receiveMessage(zmqSocket);
              if (message != null) {
                if (zmqSocket.getType() == ZMQ.REP) {
                  messageListener.onMessage(message, zmqSocket);
                } else {
                  executor.execute(
                      new Runnable() {
                        public void run() {
                          messageListener.onMessage(message, zmqSocket);
                        }
                      });
                }
              } else {
                isContextTerm = true;
              }
            }
          }
        });
  }
 @Override
 public void activate() {
   getLogger().log(Level.FINE, "ZMQDestination activate().... ");
   zmqContext = ZMQResourceFactory.createContext(zmqConfig != null ? zmqConfig.getIoThreads() : 1);
   registerZMQListener(endpointConfig, this, bus, zmqContext);
 }