Called by the communicator when a message arrives from the network layer. We queue it up for
processing and request some processing time on the main thread.
501484
public void processMessage (Message msg)
    {
        if (_client.getRunQueue().isRunning()) {
            // append it to our queue
            _actions.append(msg);
            // and queue ourselves up to be run
            _client.getRunQueue().postRunnable(this);
        } else {
            log.info("Dropping message as RunQueue is shutdown", "msg", msg);
        }
    }
1226467
def process_next_message(self, timeout):
        """"""
        message = self.worker_manager.receive(timeout)

        if isinstance(message, Acknowledgement):
            self.task_manager.task_start(message.task, message.worker)
        elif isinstance(message, Result):
            self.task_manager.task_done(message.task, message.result)
650042
public void queueDataReceivedInvocation(Connection connection,
                                              ReceiveListener listener,
                                              WsByteBuffer data,
                                              int segmentType,
                                              int requestNumber,
                                              int priority,
                                              boolean allocatedFromBufferPool,
                                              boolean partOfExchange,
                                              Conversation conversation)
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "queueDataReceivedInvocation", new Object[] {connection, listener, data, ""+segmentType, ""+requestNumber, ""+priority, ""+allocatedFromBufferPool, ""+partOfExchange, conversation});

      int dataSize = 0;
      if (dispatcherEnabled)
         dataSize = data.position();                                                                                                      // D240062

      AbstractInvocation invocation =
         allocateDataReceivedInvocation(connection,
                                        listener,
                                        data,
                                        dataSize,
                                        segmentType,
                                        requestNumber,
                                        priority,
                                        allocatedFromBufferPool,
                                        partOfExchange,
                                        conversation);

      queueInvocationCommon(invocation, (ConversationImpl)conversation);

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "queueDataReceivedInvocation");
   }
1116708
def on_message(self, message):
        
        # Called in tornado loop
        try:
            self.log.debug("Got message %s", message)
            d = json_decode(message)
            response = deserialize_object(d, Response)
            if isinstance(response, (Return, Error)):
                request = self._request_lookup.pop(response.id)
                if isinstance(response, Error):
                    # Make the message an exception so it can be raised
                    response.message = ResponseError(response.message)
            else:
                request = self._request_lookup[response.id]
            # Transfer the work of the callback to cothread
            cothread.Callback(request.callback, response)
        except Exception:
            # If we don't catch the exception here, tornado will spew odd
            # error messages about 'HTTPRequest' object has no attribute 'path'
            self.log.exception("on_message(%r) failed", message)
1313228
public void handleIncomingMessage(byte[] data, int offset, int len) {
		synchronized(messageQueue) {
			messageQueue.add(new IncomingMessage(data, offset, len));
		}
		synchronized(lock) {
			lock.notifyAll();
		}
	}
630029
def on_message(self, opcode, message):
		
		self.logger.debug("processing {0} (opcode: 0x{1:02x}) message".format(self._opcode_names.get(opcode, 'UNKNOWN'), opcode))
		if opcode == self._opcode_close:
			self.close()
		elif opcode == self._opcode_ping:
			if len(message) > 125:
				self.close()
				return
			self.send_message(self._opcode_pong, message)
		elif opcode == self._opcode_pong:
			pass
		elif opcode == self._opcode_binary:
			self.on_message_binary(message)
		elif opcode == self._opcode_text:
			try:
				message = self._decode_string(message)
			except UnicodeDecodeError:
				self.logger.warning('closing connection due to invalid unicode within a text message')
				self.close()
			else:
				self.on_message_text(message)
		elif opcode == self._opcode_continue:
			self.close()
		else:
			self.logger.warning("received unknown opcode: {0} (0x{0:02x})".format(opcode))
			self.close()
493298
@Override
    public void onReceive(Object message) throws Exception {
        try {
            if (message instanceof OperationWorkerMsgType) {
                switch ((OperationWorkerMsgType) message) {

                case PROCESS_REQUEST:
                    processMainRequest();
                    break;
                case POLL_PROGRESS:
                    pollProgress();
                    break;
                case OPERATION_TIMEOUT:
                    operationTimeout();
                    break;
                case CANCEL:
                    // use the same function
                    cancel();
                    break;
                }// end switch
            } else if (message instanceof ResponseOnSingeRequest) {
                final ResponseOnSingeRequest myResponse = (ResponseOnSingeRequest) message;
                handleHttpWorkerResponse(myResponse);
            } else {
                unhandled(message);
                throw new ActorMessageTypeInvalidException(
                        "invalid message type to OperationWorker");
            }
        } catch (Exception e) {
            replyErrors(e.toString(), PcStringUtils.printStackTrace(e),
                    PcConstants.NA, PcConstants.NA_INT);
        }
    }
321312
protected void handleRequestOut(T message) throws Fault {
        String flowId = FlowIdHelper.getFlowId(message);
        if (flowId == null
                && message.containsKey(PhaseInterceptorChain.PREVIOUS_MESSAGE)) {
            // Web Service consumer is acting as an intermediary
            @SuppressWarnings("unchecked")
            WeakReference<Message> wrPreviousMessage = (WeakReference<Message>) message
                    .get(PhaseInterceptorChain.PREVIOUS_MESSAGE);
            Message previousMessage = (Message) wrPreviousMessage.get();
            flowId = FlowIdHelper.getFlowId(previousMessage);
            if (flowId != null && LOG.isLoggable(Level.FINE)) {
                LOG.fine("flowId '" + flowId + "' found in previous message");
            }
        }

        if (flowId == null) {
            // No flowId found. Generate one.
            flowId = ContextUtils.generateUUID();
            if (LOG.isLoggable(Level.FINE)) {
                LOG.fine("Generate new flowId '" + flowId + "'");
            }
        }

        FlowIdHelper.setFlowId(message, flowId);
    }
424239
def on_receive(self, message):
        
        if self.log_file is not None and message['should_log']:
            message_copy = Message(message['text'],
                                   Metadata(None).__dict__,
                                   message['should_log']).__dict__
            with open(self.log_file, mode='w') as f:
                f.write(json.dumps(message_copy))
            logger.info(message['metadata']['source'])
        if self.listening_for(message):
            self_thread = self.HandlerThread(self.handle, message)
            self_thread.start()
        self.cleanup()
        for child in self.children:
            child.tell(message)
95668
def run(self, request_cb, notification_cb):
        
        self._request_cb = request_cb
        self._notification_cb = notification_cb
        self._msgpack_stream.run(self._on_message)
        self._request_cb = None
        self._notification_cb = None
554091
def consume(self, on_message, queue):
        
        self.channel.queue_declare(queue=queue, durable=True, exclusive=False,
                                   auto_delete=False)
        self.channel.queue_bind(queue=queue, exchange=self._exchange,
                                routing_key=self._routing_key)
        self.channel.basic_qos(prefetch_count=1)
        # Setup up our consumer callback
        self.channel.basic_consume(on_message, queue)
        # This is blocking until channel.stop_consuming is called
        # and will allow us to receive messages
        self.channel.start_consuming()
934725
def handle_message(msg, connection = {})
    intermediate = Messages::Intermediate.parse(msg)

    if Messages::Request.is_request_message?(intermediate)
      tp << ThreadPoolJob.new(intermediate) { |i|
              handle_request(i, false, connection)
            }

    elsif Messages::Notification.is_notification_message?(intermediate)
      tp << ThreadPoolJob.new(intermediate) { |i|
              handle_request(i, true, connection)
            }

    elsif Messages::Response.is_response_message?(intermediate)
      handle_response(intermediate)

    end

    intermediate
  end
46464
def enqueue_global(self, message: Message):
        
        self.enqueue(
            queue_identifier=QueueIdentifier(
                recipient=self.receiver,
                channel_identifier=CHANNEL_IDENTIFIER_GLOBAL_QUEUE,
            ),
            message=message,
        )
854145
@Override
    public void processMessage() {
        // since our computations are symmetric - we aggregate dot everywhere
        if (chunks == null) {
            chunks = new TreeMap<>();
            chunksCounter = new AtomicInteger(1);
            addToChunks(payload);
        }

        clipboard.pin(this);

        //log.info("sI_{} dot aggregation received", transport.getShardIndex());

        if (clipboard.isReady(this.getOriginatorId(), this.getTaskId())) {
            trainer.aggregationFinished(clipboard.unpin(this.getOriginatorId(), this.taskId));
        }
    }
841200
void messageReceived(MessagePacket packet) {
        if (!getCluster().isMaster())
            return;
        LOG.debug("Received packet {}", packet);

        final long now = System.nanoTime();
        packet.setTimestamp(now);

        final short node = packet.getNode();
        final NodePeer peer = peers.get(node);
        if (peer == null)
            throw new RuntimeException("Message received from unhandled node " + node);

        try {
            peer.receivePacket(packet); // we're now running in the executor we installed in the netty pipeline.
        } catch (InterruptedException ex) {
            LOG.error("InterruptedException", ex);
            throw new RuntimeException(ex);
        }
    }
1302592
def process_message(message)
      logger.info("Calling event #{message.message_type} in the channel #{message.channel_type}")
      @listener_channels[message.channel_type.to_sym].message(message.message_type.to_sym, message)
    end
500245
private void receiveMessage() {
		MessagingSystemInfo messagingSystemInfo = oneAgentSdk.createMessagingSystemInfo("DynatraceSample", "theQueue", MessageDestinationType.QUEUE, ChannelType.IN_PROCESS, null);
		IncomingMessageReceiveTracer incomingMessageReceiveTracer = oneAgentSdk.traceIncomingMessageReceive(messagingSystemInfo);
		incomingMessageReceiveTracer.start();
		try {
			Message msg = queueManager.receive("theQeue");
			if (msg == null) {
				return; // no message received
			}
			IncomingMessageProcessTracer incomingMessageProcessTracer = oneAgentSdk.traceIncomingMessageProcess(messagingSystemInfo);
			// store incoming tag to tracer:
			incomingMessageProcessTracer.setDynatraceStringTag(msg.getProperty(OneAgentSDK.DYNATRACE_MESSAGE_PROPERTYNAME));
			incomingMessageProcessTracer.setVendorMessageId(msg.getVendorMessageId());
						incomingMessageProcessTracer.start();
			try {
				// do something with the message ...
				System.out.println("Message received: " + msg.toString());
			} catch (Exception e) {
				incomingMessageProcessTracer.error(e);
			} finally {
				incomingMessageProcessTracer.end();
			}
			
			
		} catch (Exception e) {
			incomingMessageReceiveTracer.error(e);
		} finally {
			incomingMessageReceiveTracer.end();
		}
	}