/* (non-Javadoc)
@see com.ibm.ws.sib.processor.impl.interfaces.ControlHandler#handleControlMessage(com.ibm.ws.sib.mfp.control.ControlMessage)
357549
public void handleControlMessage(SIBUuid8 sourceMEUuid, ControlMessage cMsg) 
  
  throws SIConnectionLostException, SIRollbackException, SIIncorrectCallException, SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "handleControlMessage", new Object[]{sourceMEUuid,cMsg});
    
    // Work out type of ControlMessage and process it
    ControlMessageType type = cMsg.getControlMessageType();

    // Forward flush queries to our parent.  The cellule
    // we pass here doesn't actually matter since our PubSubInputHandler
    // will ignore it and just use the one in the message.
    if (type == ControlMessageType.REQUESTFLUSH) 
    {
      _parentInputHandler.handleControlMessage(_targetMEUuid, cMsg);      
    }
  
    // Forward flush queries to our parent.  The cellule
    // we pass here doesn't actually matter since our PubSubInputHandler
    // will ignore it and just use the one in the message.
    else if ( type == ControlMessageType.AREYOUFLUSHED)
    {
      _internalOutputStreamManager.processFlushQuery((ControlAreYouFlushed)cMsg);      
    }
    
    // Now we can process the rest of the control messages...
    
    else if (type == ControlMessageType.ACK)
    {
      _internalOutputStreamManager.processAck((ControlAck)cMsg);
    }
    else if (type == ControlMessageType.NACK)
    {
      _internalOutputStreamManager.processNack((ControlNack)cMsg);
    }
    else
    {
      // Not a recognised type
      // throw exception
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "handleControlMessage");

  }
377505
@Override
    public void handleNotification(Notification notification, Object handback) {
       try {
           method.invoke(target, notification, handback);
       } catch (Exception e) {
           LOG.error("Could not invoke MessageListener method " + method + " on " + target, e);
       }
        
    }
558579
@Override
    public void handleMessage(Message message) throws Fault {

        //ignore the messages from SAM Server service itself
        BindingOperationInfo boi = message.getExchange().getBindingOperationInfo();
        if (null != boi){
            String operationName = boi.getName().toString();
            if (SAM_OPERATION.equals(operationName)) {
                return;
            }
        }

        if (isRestWadlRequest(message)) {
            // skip handling REST service WADL requests - temporary fix since will be fixed in CXF soon
            return;
        }

        if (isOnewayResponse(message)) {
            // skip oneway response events
            return;
        }

        // Skip Swagger UI web static, swagger.json and swagger.yaml requests
        if (isSwaggerResourceRequest(message)) {
            return;
        }

        //check MessageID
        checkMessageID(message);

        Event event = mapper.mapToEvent(message);

        if (LOG.isLoggable(Level.FINE)) {
            String id = (event.getMessageInfo() != null) ? event.getMessageInfo().getMessageId() : null;
            LOG.fine("Store event [message_id=" + id + "] in cache.");
        }
        if (null != event) {
            queue.add(event);
        }

        // TESB-20624 skip duplicated event processing
        message.getInterceptorChain().remove(this);
    }
1341443
@SuppressWarnings("unchecked")
    public int handleOtherMessage(BaseMessage message)
    {
        // Special case - This class can also be used to start an application
        if (m_properties != null)
            if (m_properties.get(DBParams.PROCESS) == null)
                if (m_properties.get("standalone") == null)
        {
            if ((message.getMessageHeader().get(REMOVE_LISTENER) != null)
                || (message.get(REMOVE_LISTENER) != null))
            {   // Special message to get rid of this listener (typically send by server app when it is created)
                this.free();
                message.consume();
            }
            else if (m_properties.get(DBParams.APPLICATION) != null)
            {
                String strApplicationClass = (String)m_properties.get(DBParams.APPLICATION);
                Application app  = (Application)ClassServiceUtility.getClassService().makeObjectFromClassName(strApplicationClass);
                if (app != null)
                {
                    Environment env = ((BaseApplication)m_application).getEnvironment();
                    MessageApp messageApp = env.getMessageApplication(false, null);
                    if (messageApp != null)
                    {   // Move the correct application properties (such as database table type)
                        Map<String, Object> properties = messageApp.getProperties();
                        m_properties = Utility.copyAppProperties(m_properties, properties);
                    }
                    if (m_properties.get(MessageConstants.QUEUE_NAME) == null)
                        m_properties.put(MessageConstants.QUEUE_NAME, message.getMessageHeader().getQueueName());
                    if (m_properties.get(MessageConstants.QUEUE_TYPE) == null)
                        m_properties.put(MessageConstants.QUEUE_TYPE, message.getMessageHeader().getQueueType());
                    m_properties.remove(DBParams.APPLICATION);
                    m_properties.remove(MessageApplication.AUTOSTART);
                    app.init(env, m_properties, null);
                    
                    // Don't listen any more (Since application will be listening)!
                    this.free();
                    boolean bMessageSent = false;
                    for (int i = 1; ; i++)
                    {
                        String strProcessClass = (String)((MapMessage)message).get(DBParams.PROCESS + Integer.toString(i));
                        if (strProcessClass == null)
                            break;  // End of initial processes
                        bMessageSent = true;
                        Map<String,Object> properties = new HashMap<String,Object>();
                        if (message instanceof MapMessage)  // Always
                        {
                            Map<String,Object> propMessage = (Map<String,Object>)message.getData();
                            if (propMessage != null)
                                properties.putAll(propMessage);
                        }
                        properties.remove(DBParams.APPLICATION);
                        properties.remove(MessageApplication.AUTOSTART);
                        properties.put(DBParams.PROCESS, strProcessClass);
                        BaseMessage messageInitial = new MapMessage(new BaseMessageHeader(message.getMessageHeader().getQueueName(), message.getMessageHeader().getQueueType(), this, null), properties);
                        env.getMessageManager(m_application, true).sendMessage(messageInitial);   // Resend it! (Don't consume it!)
                    }
                    if (!bMessageSent)
                        env.getMessageManager(m_application, true).sendMessage(message);   // Resend it! (Don't consume it!)
                }
            }
        }
        return DBConstants.NORMAL_RETURN;
    }
1115527
public void handleMessage(
    MessageItem msg,
    TransactionCommon transaction,
    SIBUuid8 sourceMEUuid)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "handleMessage", new Object[]{msg, transaction, sourceMEUuid});
      
    SIErrorException e = new SIErrorException(
      nls.getFormattedMessage(
        "INTERNAL_MESSAGING_ERROR_CWSIP0001",
        new Object[] {
          "com.ibm.ws.sib.processor.impl.DurableInputHandler",
          "1:143:1.52.1.1" },
        null));
    
    // FFDC
    FFDCFilter.processException(
      e,
      "com.ibm.ws.sib.processor.impl.DurableInputHandler.handleMessage",
      "1:150:1.52.1.1",
      this);    
   
    SibTr.exception(tc, e);
    
    SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0001",
      new Object[] {
        "com.ibm.ws.sib.processor.impl.DurableInputHandler",
        "1:158:1.52.1.1" });

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.exit(tc, "handleMessage", e); 
       
    throw e;
  }
62787
@Override
	public void process(Packet message, MessageContext ctx)
	{
		Container c = ctx.getServerHandler().player.openContainer;
		if (message.windowId != c.windowId || !(c instanceof MalisisInventoryContainer))
			return;

		MalisisInventoryContainer container = (MalisisInventoryContainer) c;
		container.handleAction(message.action, message.inventoryId, message.slotNumber, message.code);
		container.detectAndSendChanges();
	}
757613
@Override
    public void handle(Message<Void> msg) {
        msg.reply(dependency.getClass().getName());
    }
868244
@Override
  public void handleMessage(Message message) {
    final Crouton crouton = (Crouton) message.obj;
    if (null == crouton) {
      return;
    }
    switch (message.what) {
      case Messages.DISPLAY_CROUTON: {
        displayCrouton();
        break;
      }

      case Messages.ADD_CROUTON_TO_VIEW: {
        addCroutonToView(crouton);
        break;
      }

      case Messages.REMOVE_CROUTON: {
        removeCrouton(crouton);
        if (null != crouton.getLifecycleCallback()) {
          crouton.getLifecycleCallback().onRemoved();
        }
        break;
      }

      default: {
        super.handleMessage(message);
        break;
      }
    }
  }
334161
async def handle_control_event(self, message):
        
        cmd = message[WorkerProtocol.COMMAND]
        logger.debug(__("Manager worker got channel command '{}'.", cmd))

        # Prepare settings for use; Django overlaid by state overlaid by
        # anything immediate in the current packet.
        immediates = {}
        if cmd == WorkerProtocol.COMMUNICATE:
            immediates = message.get(WorkerProtocol.COMMUNICATE_SETTINGS, {}) or {}
        override = self.state.settings_override or {}
        override.update(immediates)
        self.settings_actual = self._marshal_settings()
        self.settings_actual.update(override)

        if cmd == WorkerProtocol.COMMUNICATE:
            try:
                await database_sync_to_async(self._data_scan)(**message[WorkerProtocol.COMMUNICATE_EXTRA])
            except Exception:
                logger.exception("Unknown error occured while processing communicate control command.")
                raise
            finally:
                await self.sync_counter.dec('communicate')

        elif cmd == WorkerProtocol.FINISH:
            try:
                data_id = message[WorkerProtocol.DATA_ID]
                data_location = DataLocation.objects.get(data__id=data_id)
                if not getattr(settings, 'FLOW_MANAGER_KEEP_DATA', False):
                    try:
                        def handle_error(func, path, exc_info):
                            """Handle permission errors while removing data directories."""
                            if isinstance(exc_info[1], PermissionError):
                                os.chmod(path, 0o700)
                                shutil.rmtree(path)

                        # Remove secrets directory, but leave the rest of the runtime directory
                        # intact. Runtime directory will be removed during data purge, when the
                        # data object is removed.
                        secrets_dir = os.path.join(
                            self._get_per_data_dir('RUNTIME_DIR', data_location.subpath),
                            ExecutorFiles.SECRETS_DIR
                        )
                        shutil.rmtree(secrets_dir, onerror=handle_error)
                    except OSError:
                        logger.exception("Manager exception while removing data runtime directory.")

                if message[WorkerProtocol.FINISH_SPAWNED]:
                    await database_sync_to_async(self._data_scan)(**message[WorkerProtocol.FINISH_COMMUNICATE_EXTRA])
            except Exception:
                logger.exception(
                    "Unknown error occured while processing finish control command.",
                    extra={'data_id': data_id}
                )
                raise
            finally:
                await self.sync_counter.dec('executor')

        elif cmd == WorkerProtocol.ABORT:
            await self.sync_counter.dec('executor')

        else:
            logger.error(__("Ignoring unknown manager control command '{}'.", cmd))
573016
public void handleFlushedMessage(ControlFlushed cMsg)
    throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this, tc, "handleFlushedMessage", new Object[] { cMsg });

    SIBUuid12 streamID = cMsg.getGuaranteedStreamUUID();
    forceFlush(streamID);

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "handleFlushedMessage");
  }
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();
    }
914304
@Override
    public String handleEventMessage(String msg, Object msgdoc,
            Map<String, String> metainfo) throws EventHandlerException {
        return null;
    }
406642
function handleMessage(m, workerIdx) {
	var job = jobs[m.context.jobID];

	switch(job.type) {
		case 'func':
			handleArrayResult(m, workerIdx);
			break;
		case 'exec':
			handleExecResult(m, workerIdx);
			break;
		default:
			throw Error('Invalid job type: ' + job.type);
	}
}
159270
@Override
    public void handleMessage(Message message) throws Fault {
        String method = (String) message.get(Message.HTTP_REQUEST_METHOD);
        String query = (String) message.get(Message.QUERY_STRING);
        if (!"GET".equals(method) || StringUtils.isEmpty(query)) {
            return;
        }
        String baseUri = (String) message.get(Message.REQUEST_URL);
        String ctx = (String) message.get(Message.PATH_INFO);

        //cannot have two wsdl's being written for the same endpoint at the same
        //time as the addresses may get mixed up
        synchronized (message.getExchange().getEndpoint()) {
            Map<String, String> map = UrlUtils.parseQueryString(query);
            if (isRecognizedQuery(map, baseUri, ctx,
                                  message.getExchange().getEndpoint().getEndpointInfo())) {

                try {
                    Conduit c = message.getExchange().getDestination().getBackChannel(message, null, null);
                    Message mout = new MessageImpl();
                    mout.setExchange(message.getExchange());
                    message.getExchange().setOutMessage(mout);
                    //Customize the response to 404
                    mout.put(Message.RESPONSE_CODE, HttpURLConnection.HTTP_NOT_FOUND);
                    mout.put(Message.CONTENT_TYPE, "text/xml");
                    c.prepare(mout);
                    OutputStream os = mout.getContent(OutputStream.class);

                    Document doc = getDocument(message,
                                               baseUri,
                                               map,
                                               ctx,
                                               message.getExchange().getEndpoint().getEndpointInfo());

                    String enc = null;
                    try {
                        enc = doc.getXmlEncoding();
                    } catch (Exception ex) {
                        //ignore - not dom level 3
                    }
                    if (enc == null) {
                        enc = "utf-8";
                    }

                    XMLStreamWriter writer = null;
                    try {
                        writer = StaxUtils.createXMLStreamWriter(os, enc);
                        StaxUtils.writeNode(doc, writer, true);
                        message.getInterceptorChain().abort();
                        writer.flush();
                        os.flush();
                    } catch (IOException ex) {
                        if (TraceComponent.isAnyTracingEnabled() && tc.isInfoEnabled()) {
                            Tr.info(tc, "error.write.wsdl.stream", ex);
                        }
                        //LOG.log(Level.FINE, "Failure writing full wsdl to the stream", ex);
                        //we can ignore this.   Likely, whatever has requested the WSDL
                        //has closed the connection before reading the entire wsdl.  
                        //WSDL4J has a tendency to not read the closing tags and such
                        //and thus can sometimes hit this.   In anycase, it's 
                        //pretty much ignorable and nothing we can do about it (cannot
                        //send a fault or anything anyway
                    } finally {
                        if (writer != null) {
                            try {
                                writer.close();
                            } catch (Exception e) {
                            }
                        }
                        try {
                            os.close();
                        } catch (Exception e) {
                        }
                    }
                } catch (IOException e) {
                    throw new Fault(e);
                } catch (XMLStreamException e) {
                    throw new Fault(e);
                } finally {
                    message.getExchange().setOutMessage(null);
                }
            }
        }
    }
62929
public void handleMessage(T message) throws Fault {
        if (LOG.isLoggable(Level.FINEST)) {
            LOG.finest("FlowIdProducerOut Interceptor called. isOutbound: "
                    + MessageUtils.isOutbound(message) + ", isRequestor: "
                    + MessageUtils.isRequestor(message));
        }

        if (MessageUtils.isRequestor(message)) {
            handleRequestOut(message);
        } else {
            handleResponseOut(message);
        }

        // Don't write flowId for Oneway responses
        if (isOnewayResponse(message)) {
            return;
        }

        // write FlowId to HTTP and Soap layer
        String flowId = FlowIdHelper.getFlowId(message);
        FlowIdProtocolHeaderCodec.writeFlowId(message, flowId);
        FlowIdSoapCodec.writeFlowId(message, flowId);

    }
1044405
private void handleIncomingRequestMessage(SerialMessage incomingMessage) {
		logger.debug("Message type = REQUEST");
		switch (incomingMessage.getMessageClass()) {
			case ApplicationCommandHandler:
				handleApplicationCommandRequest(incomingMessage);
				break;
			case SendData:
				handleSendDataRequest(incomingMessage);
				break;
			case ApplicationUpdate:
				handleApplicationUpdateRequest(incomingMessage);
				break;
		default:
			logger.warn(String.format("TODO: Implement processing of Request Message = %s (0x%02X)",
					incomingMessage.getMessageClass().getLabel(),
					incomingMessage.getMessageClass().getKey()));
			break;	
		}
	}
761200
public int handleMessage(BaseMessage message)
    {
        Map<String,Object> properties = new HashMap<String,Object>();
        String strMessageType =  (String)message.get(MessageConstants.MESSAGE_TYPE_PARAM);
        String strStartIndex = (String)message.get(START_INDEX_PARAM);
        String strEndIndex = (String)message.get(END_INDEX_PARAM);
        if (strMessageType != null)
            properties.put(MessageConstants.MESSAGE_TYPE_PARAM, strMessageType);
        if (strStartIndex != null)
            properties.put(START_INDEX_PARAM, strStartIndex);
        if (strEndIndex != null)
            properties.put(END_INDEX_PARAM, strEndIndex);
        Map<String,Object> propertiesHdr = null;
        if (message.getMessageHeader() != null)
            propertiesHdr = message.getMessageHeader().getProperties();
        if (propertiesHdr != null)
            properties.putAll(propertiesHdr); // Merge them to simplify access
        if (properties != null)
        {
            strMessageType =  (String)properties.get(MessageConstants.MESSAGE_TYPE_PARAM);
            try {
                int iMessageType = Integer.parseInt(strMessageType);
                if ((Constants.AFTER_ADD_TYPE == iMessageType)
                    || (Constants.AFTER_DELETE_TYPE == iMessageType)
                    || (Constants.AFTER_UPDATE_TYPE == iMessageType))
                {
                    SwingUtilities.invokeLater(new UpdateGridTable(properties));
                }
            } catch (NumberFormatException ex) {
                // Ignore
            }
        }
        return super.handleMessage(message);
    }