Handle an AgentJobStarted message. Send the data back to the client
180327
async def handle_agent_job_started(self, agent_addr, message: AgentJobStarted):
        """"""
        self._logger.debug("Job %s %s started on agent %s", message.job_id[0], message.job_id[1], agent_addr)
        await ZMQUtils.send_with_addr(self._client_socket, message.job_id[0], BackendJobStarted(message.job_id[1]))
856148
protected void fireStart(CmsPublishJobEnqueued publishJob) {

        if (LOG.isDebugEnabled()) {
            LOG.debug(Messages.get().getBundle().key(Messages.LOG_PUBLISH_JOB_START_0));
        }
        for (Iterator<I_CmsPublishEventListener> it = iterator(); it.hasNext();) {
            I_CmsPublishEventListener listener = it.next();
            try {
                listener.onStart(publishJob);
            } catch (Throwable t) {
                // catch every thing including runtime exceptions
                if (LOG.isErrorEnabled()) {
                    LOG.error(
                        Messages.get().getBundle().key(
                            Messages.ERR_PUBLISH_JOB_START_ERROR_1,
                            listener.getClass().getName()),
                        t);
                }
                if (publishJob.m_publishJob.getPublishReport() != null) {
                    publishJob.m_publishJob.getPublishReport().println(t);
                }
            }
        }
        // popup the start message
        boolean busyStart = ((System.currentTimeMillis() - publishJob.getEnqueueTime()) > 2000);
        boolean bigJob = ((publishJob.getPublishList().size() > 25)
            || (OpenCms.getStaticExportManager().getHandler() instanceof CmsAfterPublishStaticExportHandler));
        if (busyStart || bigJob) {
            String msgText = Messages.get().getBundle(publishJob.getLocale()).key(
                Messages.GUI_PUBLISH_JOB_STARTED_1,
                new Long(publishJob.getEnqueueTime()));
            m_publishEngine.sendMessage(publishJob.getUserId(), msgText, false);
        }
    }
910553
function sendMessage (client, data, batchCallback) {
  var msg = data.msg;
  var offset = data.offset;
  var length = data.length;
  var port = data.port;
  var address = data.address;
  var callback = data.callback;

  client.send(msg, offset, length, port, address, function(err) {
    try {
      callback(err);
    } finally {
      batchCallback();
    }
  });
}
1031942
def HandleMessage(self, message):
    
    self._is_active = True
    try:
      action_cls = actions.ActionPlugin.classes.get(message.name)
      if action_cls is None:
        raise RuntimeError("Client action %r not known" % message.name)

      action = action_cls(grr_worker=self)

      # Write the message to the transaction log.
      self.transaction_log.Write(message)

      # Heartbeat so we have the full period to work on this message.
      action.Progress()
      action.Execute(message)

      # If we get here without exception, we can remove the transaction.
      self.transaction_log.Clear()
    finally:
      self._is_active = False
      # We want to send ClientStats when client action is complete.
      self.stats_collector.RequestSend()
945974
function(message) {
    // Send notification as a proactive message 
    var activity = message.activity
    var reference = TurnContext.getConversationReference(activity); 
    MicrosoftAppCredentials.trustServiceUrl(activity.serviceUrl);
    
    adapter.continueConversation(reference, async (context) => {
        // Complete the job.
        await bot.processChatResponse(context, message);
    });
}
796043
@Override
	public void processMessage(WebSocketMessage webSocketData) throws FrameworkException {

		setDoTransactionNotifications(true);

		final String mode                     = webSocketData.getNodeDataStringValue("mode");		// default: list    start | pause | resume | cancel | abort
		final Long jobId                      = webSocketData.getNodeDataLongValue("jobId");

		final JobQueueManager mgr = JobQueueManager.getInstance();

		final List<GraphObject> result = new LinkedList<>();

		switch (mode) {

			case "start":
				mgr.startJob(jobId);
				break;

			case "pause":
				mgr.pauseRunningJob(jobId);
				break;

			case "resume":
				mgr.resumePausedJob(jobId);
				break;

			case "abort":
				mgr.abortActiveJob(jobId);
				break;

			case "cancel":
				mgr.cancelQueuedJob(jobId);
				break;

			case "list":
			default:
				final GraphObjectMap importsContainer = new GraphObjectMap();

				importsContainer.put(importJobsProperty, mgr.listJobs());
				result.add(importsContainer);
		}

			webSocketData.setResult(result);
			webSocketData.setRawResultCount(1);
			getWebSocket().send(webSocketData, true);

	}
785800
async def handle_agent_job_done(self, agent_addr, message: AgentJobDone):
        """"""

        if agent_addr in self._registered_agents:
            self._logger.info("Job %s %s finished on agent %s", message.job_id[0], message.job_id[1], agent_addr)

            # Remove the job from the list of running jobs
            del self._job_running[message.job_id]

            # Sent the data back to the client
            await ZMQUtils.send_with_addr(self._client_socket, message.job_id[0], BackendJobDone(message.job_id[1], message.result,
                                                                                                 message.grade, message.problems,
                                                                                                 message.tests, message.custom,
                                                                                                 message.state, message.archive,
                                                                                                 message.stdout, message.stderr))

            # The agent is available now
            self._available_agents.append(agent_addr)
        else:
            self._logger.warning("Job result %s %s from non-registered agent %s", message.job_id[0], message.job_id[1], agent_addr)

        # update the queue
        await self.update_queue()
691226
async def message(**payload):
    
    data = payload["data"]
    web_client = payload["web_client"]
    channel_id = data.get("channel")
    user_id = data.get("user")
    text = data.get("text")

    if text and text.lower() == "start":
        return await start_onboarding(web_client, user_id, channel_id)
875389
public synchronized void send(final ReefServiceProtos.JobStatusProto status) {
    LOG.log(Level.FINEST, "Sending to client: status={0}", status.getState());
    this.jobStatusHandler.onNext(status);
  }
1255635
function Agent_onRequest(message) {
  var mName = message.name

  var cb = this._receiveCBs.get(mName)

  if (!cb) {
    message = {
      type:  "response",
      name:  mName,
      from:  this.info.id,
      id:    message.id,
      error: "agent does not handle messages named '" + mName + "'"
    }

    this._session._sendMessage(message)
    return
  }

  var agent = this

  try {
    cb(message.body, reply)

  }
  catch (e) {
    reply(err, null)
  }

  //-----------------------------------
  var replied = false

  function reply(err, body) {
    if (replied) return
    replied = true

    var rMessage = {
      type:  "response",
      name:  mName,
      from:  agent.info.id,
      id:    message.id,
      body:  body
    }

    if (err) rMessage.error = err

    agent._session._sendMessage(rMessage)
  }
}
549310
def handle(self, message):
        '''
        
        '''

        logger.debug(message)
        if Utilities.isNotEmpty(message['metadata']['opts']):
            target = message['metadata']['opts']['target']
            self.botThread.create_message(target, message['text'])
1070861
def send_message(self, data, inc_session_id=False,
                     callback_function=None):
        
        self._check_registered()

        if not self.target_platform and \
           self.namespace not in self._socket_client.app_namespaces:
            if self.supporting_app_id is not None:
                self.launch()

            else:
                raise UnsupportedNamespace(
                    ("Namespace {} is not supported by running"
                     "application.").format(self.namespace))

        return self._message_func(
            self.namespace, data, inc_session_id, callback_function)
486142
def handle_message(self, connection, sender, target, message):
        
        parts = message.strip().split(' ', 2)
        if parts and parts[0].lower() == '!bot':
            try:
                command = parts[1].lower()
            except IndexError:
                self.safe_send(connection, target, "No command given")
                return

            try:
                payload = parts[2]
            except IndexError:
                payload = ""

            self.__pool.enqueue(self._handle_command,
                                connection, sender, target, command, payload)
678110
def handle(self, message):
        '''
        
        '''

        logger.debug(message)
        if Utilities.isNotEmpty(message['metadata']['opts']):
            target = message['metadata']['opts']['target']

            for split_line in Utilities.tokenize(message['text']):
                for truncated_line in Utilities.truncate(split_line):
                    self.botThread.connection.privmsg(target, truncated_line)
                    # Delay to prevent floods
                    time.sleep(0.25)
823524
function handleIncomingMessage(data) {
		var message;
		reader.parse(data, initPending);
		initPending = false;
		while (!reader.isEmpty()) {
			message = reader.pop();
			// console.log("IN MESSAGE: " + inspect(message));
			// Check if there are listeners attached to the event
			// otherwise falls back to the default handler
			if (that.listeners(message.verb).length) {
				handlers[message.verb](message);
			} else {
				defHandlers[message.verb].call(that, message);
			}
		}
	}
604340
private void handleSendDataResponse(SerialMessage incomingMessage) {
		logger.trace("Handle Message Send Data Response");
		if(incomingMessage.getMessageBuffer()[2] != 0x00)
			logger.debug("Sent Data successfully placed on stack.");
		else
			logger.error("Sent Data was not placed on stack due to error.");
	}
333496
function sendClientConsoleMessage(ws, message) {
  var msg = JSON.stringify({
    custom: {
      console: message
    }
  });
  ws.write(msg);
}