Receiving messages

@param message message
777997
@Override
    public void onReceive(Object message) {
        if (message instanceof NewMessage) {
            NewMessage newMessage = (NewMessage) message;
            onNewMessage(newMessage.getPeer(), newMessage.getSender(), newMessage.getSortDate(),
                    newMessage.getContentDescription(), newMessage.getHasCurrentUserMention(),
                    newMessage.getUnreadMessagesCount(), newMessage.getUnreadDialogsCount());
        } else if (message instanceof MessagesRead) {
            MessagesRead read = (MessagesRead) message;
            onMessagesRead(read.getPeer(), read.getFromDate());
        } else if (message instanceof PauseNotifications) {
            onNotificationsPaused();
        } else if (message instanceof ResumeNotifications) {
            onNotificationsResumed();
        } else {
            super.onReceive(message);
        }
    }
141857
public static void toast(String message) {

        Toast toast = Toast.makeText(QuickUtils.getContext(), message, Toast.LENGTH_SHORT);
        toast.show();
    }
1034651
@POST
    public void broadcast(String message) {
        AtmosphereResource r = (AtmosphereResource) request.getAttribute(ApplicationConfig.ATMOSPHERE_RESOURCE);

        if (r != null) {
            r.getBroadcaster().broadcast(message);
        } else {
            throw new IllegalStateException();
        }
    }
1020867
public void showMessage(final String message)
	{
		display.asyncExec(new Runnable()
		{

			public void run()
			{

				cw.println(message);
				cw.show();
			}
		});
	}
260923
private void doPushMessage(AbstractMessage message) {
        if (log.isTraceEnabled()) {
            String msgType = message.getMessageType();
            log.trace("doPushMessage: {}", msgType);
        }
        IMessageOutput out = msgOutReference.get();
        if (out != null) {
            try {
                out.pushMessage(message);
                if (message instanceof RTMPMessage) {
                    IRTMPEvent body = ((RTMPMessage) message).getBody();
                    // update the last message sent's timestamp
                    lastMessageTs = body.getTimestamp();
                    IoBuffer streamData = null;
                    if (body instanceof IStreamData && (streamData = ((IStreamData<?>) body).getData()) != null) {
                        bytesSent.addAndGet(streamData.limit());
                    }
                }
            } catch (IOException err) {
                log.warn("Error while pushing message", err);
            }
        } else {
            log.warn("Push message failed due to null output pipe");
        }
    }
634776
public void sendMessage(final byte[] message) {
        try {
            session.sendMessage(new BinaryMessage(message));
        }
        catch (IOException e) {
            logger.error("[sendBinaryMessage]", e);
        }
    }
487552
def receive_message(self):
        """"""
        with self.lock:
            assert self.can_receive_messages()
            message_type = self._read_message_type(self._file)
            message = message_type(self._file, self)
            self._message_received(message)
272627
@Override
    public void handleMessage(final Message message) throws Fault {
        OutputStream os = message.getContent(OutputStream.class);

        if (null == os) {
            String encoding = (String) message.get(Message.ENCODING);
            if (encoding == null) {
                encoding = "UTF-8";
            }

            final Writer writer = message.getContent(Writer.class);
            if (null != writer) {
                os = new WriterOutputStream(writer, encoding);
                message.setContent(Writer.class,null);
            }
        }

        if (null != os) {
            final CacheAndWriteTapOutputStream newOut = new CacheAndWriteTapOutputStream(os);

            message.setContent(OutputStream.class, newOut);

            if (WireTapHelper
                    .isMessageContentToBeLogged(message, logMessageContent, logMessageContentOverride)) {
                message.setContent(CachedOutputStream.class, newOut);
            }else {
                try {
                    final CachedOutputStream cos = new CachedOutputStream();
                    cos.write(WireTapHelper.CONTENT_LOGGING_IS_DISABLED.getBytes(Charset.forName("UTF-8")));
                    message.setContent(CachedOutputStream.class, cos);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            if (wireTap != null) {
                newOut.registerCallback(new CallBack(message));
            }
        }
    }
781412
public int sendMessage(Message message)
    {
        BaseMessageHeader messageHeader = ((BaseMessage)message).getMessageHeader();
        String strQueueType = messageHeader.getQueueType();
        String strQueueName = messageHeader.getQueueName();
        MessageSender sender = this.getMessageQueue(strQueueName, strQueueType).getMessageSender();
        if (sender != null)
            sender.sendMessage(message);
        else
            return Constant.ERROR_RETURN;  // Queue doesn't exist
        return Constant.NORMAL_RETURN;
    }
264923
public void sendMessage(String message) {
		try {
			getChat().sendMessage(message);
		} catch (XMPPException | NotConnectedException e) {
			e.printStackTrace();
		}
	}
949509
@Override
    public void sendMsg(Message message) {
        try {
            message.setSender(this.getID());
            ShanksAgent receiver = this.simulation.getAgent(message
                    .getReceiver());
            receiver.putMessegaInInbox(message);
            logger.finer("Sent message from Agent: " + this.getID()
                    + " to Agent: " + message.getReceiver());
        } catch (UnkownAgentException e) {
            logger.severe("UnkownAgentException: " + e.getMessage());
            e.printStackTrace();
        } catch (ShanksException e) {
            e.printStackTrace();
        }
    }
435935
public void requestBroadcast (String message)
    {
        message = filter(message, null, true);
        if (message == null) {
            displayFeedback(_bundle, MessageBundle.compose("m.broadcast_failed", "m.filtered"));
            return;
        }
        _cservice.broadcast(message, new ChatService.InvocationListener() {
            public void requestFailed (String reason) {
                reason = MessageBundle.compose("m.broadcast_failed", reason);
                displayFeedback(_bundle, reason);
            }
        });
    }
879619
public Message receiveMessage()
    {
        DualMessageQueue baseMessageQueue = (DualMessageQueue)this.getMessageQueue();
        if (baseMessageQueue == null)
            return null;    // In free
        return baseMessageQueue.getMessageStack().receiveMessage();
    }
222213
public void onMessage(Message msg) {
	        try {
                    LOG.debug("Queuing msg [" + msg.getJMSMessageID() + "]");
                } catch (JMSException e) {
                }
		this.queue.offer(msg);
	}
907984
void deliverTaskMessage(final byte[] message) {
    synchronized (this.contextLifeCycle) {
      if (!this.task.isPresent()) {
        LOG.log(Level.WARNING, "Received a task message while there was no task running. Ignoring.");
      } else {
        this.task.get().deliver(message);
      }
    }
  }
665816
public void reply(Object message) {
        if (context.sender() != null) {
            context.sender().send(message, self());
        }
    }
276591
protected void handleMessage(@NonNull VoidMessage message) {
        if (message == null) {
            //            log.info("sI_{} got null message", getShardIndex());
            return;
        }

        if (message.getTargetId() >= 0 && message.getTargetId() != shardIndex) {
            log.warn("sI_{}: Skipping message: [{}]; TargetIdx: [{}]", shardIndex, message.getClass().getSimpleName(),
                            message.getTargetId());
            return;
        }

        //      log.info("sI_{}: Processing message: [{}]", shardIndex, message.getClass().getSimpleName());

        message.attachContext(voidConfiguration, trainer, clipboard, transport, storage, nodeRole, shardIndex);
        message.processMessage();
    }