Executed on an authentication request.

@param message
the amqp message
@return the rpc message back to supplier.
765454
@RabbitListener(queues = "${hawkbit.dmf.rabbitmq.authenticationReceiverQueue:authentication_receiver}", containerFactory = "listenerContainerFactory")
    public Message onAuthenticationRequest(final Message message) {
        checkContentTypeJson(message);
        final SecurityContext oldContext = SecurityContextHolder.getContext();
        try {
            return handleAuthenticationMessage(message);
        } catch (final RuntimeException ex) {
            throw new AmqpRejectAndDontRequeueException(ex);
        } finally {
            SecurityContextHolder.setContext(oldContext);
        }
    }
5808
public static StanzaIdElement getStanzaId(Message message) {
        return message.getExtension(StanzaIdElement.ELEMENT, StableUniqueStanzaIdManager.NAMESPACE);
    }
607094
protected Method resolveTargetMethod(Message message,
                                         FieldDescriptor payloadField) {
        Method targetMethod = fieldToMethod.get(payloadField);

        if (targetMethod == null) {
            // look up and cache target method; this block is called only once
            // per target method, so synchronized is ok
            synchronized (this) {
                targetMethod = fieldToMethod.get(payloadField);
                if (targetMethod == null) {
                    String name = payloadField.getName();
                    for (Method method : service.getClass().getMethods()) {
                        if (method.getName().equals(name)) {
                            try {
                                method.setAccessible(true);
                            } catch (Exception ex) {
                                log.log(Level.SEVERE,"Error accessing RPC method",ex);
                            }

                            targetMethod = method;
                            fieldToMethod.put(payloadField, targetMethod);
                            break;
                        }
                    }
                }
            }
        }

        if (targetMethod != null) {
            return targetMethod;
        } else {
            throw new RuntimeException("No matching method found by the name '"
                    + payloadField.getName() + "'");
        }
    }
248749
public CallActivityMock onExecutionSendMessage(final String message) {
    return onExecutionDo(execution -> execution.getProcessEngineServices()
      .getRuntimeService().correlateMessage(message));
  }
909309
private byte[] getHMAC(byte[] message) {

        try {
            return getMacInstance(mode, key).doFinal(message);
        }
        catch (InvalidKeyException e) {

            // As the key is verified during construction of the TOTPGenerator,
            // this should never happen
            throw new IllegalStateException("Provided key became invalid after "
                    + "passing validation.", e);

        }

    }
536039
public VehicleMessage request(KeyedMessage message) {
        BlockingMessageListener callback = new BlockingMessageListener();
        request(message, callback);
        return callback.waitForResponse();
    }
976786
public void request(
            final Message message,
            final OperationResult<Message, Exception> onResponse) {

        if (message == null) {
            throw new IllegalArgumentException("message cannot be null");
        }
        if (message.getMessageId() != null) {
            throw new IllegalArgumentException("message.getMessageId() should be null");
        }
        if (message.getReplyTo() != null) {
            throw new IllegalArgumentException("message.getReplyTo() should be null");
        }
        message.setMessageId("request" + UnsignedLong.valueOf(this.requestId.incrementAndGet()).toString());
        message.setReplyTo(this.replyTo);

        this.inflightRequests.put(message.getMessageId(), onResponse);

        sendLink.delivery(UUID.randomUUID().toString().replace("-", StringUtil.EMPTY).getBytes(UTF_8));
        final int payloadSize = AmqpUtil.getDataSerializedSize(message) + 512; // need buffer for headers

        final byte[] bytes = new byte[payloadSize];
        final int encodedSize = message.encode(bytes, 0, payloadSize);

        receiveLink.flow(1);
        sendLink.send(bytes, 0, encodedSize);
        sendLink.advance();
    }
28592
private void sendMessage(AuthenticationManagerRequest req) {
    Message<AuthenticationManagerRequest> msg = new Message<AuthenticationManagerRequest>(AuthenticationManagerCommandAction.COMMAND_NAME, req);
    try {
      sender.sendMessage(msg, null);
    } catch (Exception e) {
      log.error("Failed to update authentication.", e);
    }
  }
166575
@Override
    @SuppressWarnings("unchecked")
    public void onMessage(StreamMessage message)
    {
        String endopointUri = getEndpointUri();

        Map<String, Object> resultMap;

        try
        {
            resultMap = this.converter.toMap(message);
        }
        catch (ConvertFailException ex)
        {
            String logFormat = "Fail convert to jdbc record. Dispose received message. : Message={0}";
            logger.warn(MessageFormat.format(logFormat, message), ex);
            ack();
            return;
        }

        List<Object> valueList = Lists.newArrayList();

        valueList.add(resultMap.get("messageId"));
        valueList.add(resultMap.get("timestamp"));
        valueList.add(resultMap.get("source"));

        List<String> bodyList = (List<String>) resultMap.get("body");

        valueList.addAll(bodyList);

        insert(endopointUri, valueList);
        ack();
    }
231851
@Override
	public Response checkMessagingConnectionForTheDm( String message ) {

		this.logger.fine( "Request: check the connection to the message queue. message=" + message );
		Response response;
		String lang = lang( this.manager );
		if( this.manager.debugMngr().pingMessageQueue( message ))
			response = handleError( Status.OK, new RestError( REST_DEBUG_AGENT_KO, name( "ECHO" ), value( message )), lang ).build();
		else
			response = handleError( Status.INTERNAL_SERVER_ERROR, new RestError( REST_MESSAGING_ERROR ), lang ).build();

		return response;
	}
624829
public void sendMessage(Message message)
    {
        try   {
            if (((RemoteMessageQueue)this.getMessageQueue()).isSendRemoteMessage((BaseMessage)message) == false)
                return;
            if (((BaseMessage)message).isProcessedByServer())
                return;     // Don't send back down (the server already processed it).
            if (((BaseMessage)message).isConsumed())
                return;     // Don't send if already handled.
            if (MessageConstants.LOCAL_QUEUE.equalsIgnoreCase(((BaseMessage)message).getMessageHeader().getQueueType()))
                return;     // Local queue only
            synchronized (m_sendQueue)
            {   // In case this is called from another task
                m_sendQueue.sendMessage(message);
            }
        } catch (RemoteException ex)    {
            ex.printStackTrace();
        }
    }
1310183
public static String log(final String message) {

        final String ticket = String.valueOf(System.currentTimeMillis());
        // using a deferred command just to be more responsible
        // since we do not expect any feed back from it
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            /**
             * @see com.google.gwt.user.client.Command#execute()
             */
            public void execute() {

                getLoggingService().log(ticket, message, new AsyncCallback<Void>() {

                    /**
                     * @see com.google.gwt.user.client.rpc.AsyncCallback#onFailure(java.lang.Throwable)
                     */
                    public void onFailure(Throwable caught) {

                        // logging failed, really bad
                        // but the only thing we can do is to ignore it
                    }

                    /**
                     * @see com.google.gwt.user.client.rpc.AsyncCallback#onSuccess(Object)
                     */
                    public void onSuccess(Void result) {

                        // logged successfully
                    }
                });
            }
        });
        return ticket;
    }
613351
public int handleMessage(BaseMessage message)
    {
        Utility.getLogger().info("RemoteQueue handling message " + message);
        if (message.getProcessedByClientSession() == this.getParentSession())
            return DBConstants.NORMAL_RETURN;     // Do not process this message (the client has already taken care of it).
//?        if (message.getProcessedByClientSession() instanceof RemoteObject)
//?            if (this.getParentSession() instanceof RemoteObject) // Always
//?                if (((RemoteObject)this.getParentSession()).getRef().remoteEquals(((RemoteObject)message.getProcessedByClientSession()).getRef()))
//?                    return DBConstants.NORMAL_RETURN;   // Same client.
        if (message == m_messageLastMessage)
            return DBConstants.NORMAL_RETURN;   // Don't send a message to the same client twice.
        m_messageLastMessage = message;
        this.getMessageStack().sendMessage(message);
        return DBConstants.NORMAL_RETURN;
    }
243774
public String checkMessagingConnectionForTheDm( String message )
	throws DebugWsException {

		this.logger.finer( "Checking messaging connection with the DM: message=" + message );

		WebResource path = this.resource.path( UrlConstants.DEBUG ).path( "check-dm" );
		if( message != null )
			path = path.queryParam( "message", message );

		ClientResponse response = this.wsClient.createBuilder( path ).get( ClientResponse.class );
		if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) {
			String value = response.getEntity( String.class );
			this.logger.finer( response.getStatusInfo() + ": " + value );
			throw new DebugWsException( response.getStatusInfo().getStatusCode(), value );
		}

		this.logger.finer( String.valueOf( response.getStatusInfo()));
		return response.getEntity( String.class );
	}
170834
private void doQueueElement(final Message<JsonObject> message) {
    final String name = message.body().getString("name");
    if (name == null) {
      message.reply(new JsonObject().putString("status", "error").putString("message", "No name specified."));
      return;
    }

    context.execute(new Action<Object>() {
      @Override
      public Object perform() {
        return data.getQueue(formatKey(name)).element();
      }
    }, new Handler<AsyncResult<Object>>() {
      @Override
      public void handle(AsyncResult<Object> result) {
        if (result.failed()) {
          message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage()));
        } else {
          message.reply(new JsonObject().putString("status", "ok").putValue("result", result.result()));
        }
      }
    });
  }
580671
public Object invoke(WampMessage message, Object... providedArgs) throws Exception {
		Object[] args = getMethodArgumentValues(message, providedArgs);
		if (this.logger.isTraceEnabled()) {
			this.logger.trace("Resolved arguments: " + Arrays.asList(args));
		}
		Object returnValue = doInvoke(args);
		if (this.logger.isTraceEnabled()) {
			this.logger.trace("Returned value: " + returnValue);
		}
		return returnValue;
	}
553206
public byte[] sign(byte[] message) {
		try {
			// this way signatureInstance should be thread safe
			final Signature signatureInstance = ((provider == null) || (provider.length() == 0)) ? Signature
					.getInstance(algorithm) : Signature.getInstance(algorithm, provider);
			signatureInstance.initSign(privateKey);
			signatureInstance.update(message);
			return signatureInstance.sign();
		} catch (Exception e) {
			throw new SignatureException("error generating the signature: algorithm=" + algorithm, e);
		}
	}