Package eu.mosaic_cloud.interoperability.core

Examples of eu.mosaic_cloud.interoperability.core.Message


   */
  public void sendConsumeOk (final Session session, final String consumerTag)
  {
    final AmqpPayloads.ConsumeOkMessage.Builder consumePayload = ConsumeOkMessage.newBuilder ();
    consumePayload.setConsumerTag (consumerTag);
    final Message message = new Message (AmqpMessage.CONSUME_OK, consumePayload.build ());
    this.publishResponse (session, message);
    this.logger.trace ("AmqpResponseTransmitter - Sent CONSUME Ok callback for consumer " + consumerTag + ".");
  }
View Full Code Here


      deliveryPayload.setReplyTo (message.getCallback ());
    }
    if (message.getCorrelation () != null) {
      deliveryPayload.setCorrelationId (message.getCorrelation ());
    }
    final Message mssg = new Message (AmqpMessage.DELIVERY, deliveryPayload.build ());
    // NOTE: send response
    this.publishResponse (session, mssg);
    this.logger.trace ("AmqpResponseTransmitter - Delivered message");
  }
View Full Code Here

   * @param isError
   *            <code>true</code> if the result is actual an error
   */
  public void sendResponse (final Session session, final CompletionToken token, final AmqpOperations operation, final Object result, final boolean isError)
  {
    Message message = null;
    if (isError) {
      // NOTE: create error message
      final Error.Builder errorPayload = IdlCommon.Error.newBuilder ();
      errorPayload.setToken (token);
      errorPayload.setErrorMessage (result.toString ());
      message = new Message (AmqpMessage.ERROR, errorPayload.build ());
    } else {
      switch (operation) {
        case DECLARE_EXCHANGE :
        case DECLARE_QUEUE :
        case BIND_QUEUE :
        case PUBLISH :
        case GET :
        case CANCEL :
        case ACK :
          final boolean success = ((Boolean) result).booleanValue ();
          if (success) {
            final Ok.Builder okPayload = IdlCommon.Ok.newBuilder ();
            okPayload.setToken (token);
            message = new Message (AmqpMessage.OK, okPayload.build ());
          } else {
            final NotOk.Builder nokPayload = IdlCommon.NotOk.newBuilder ();
            nokPayload.setToken (token);
            message = new Message (AmqpMessage.NOK, nokPayload.build ());
          }
          break;
        case CONSUME :
          final ConsumeReply.Builder consumePayload = AmqpPayloads.ConsumeReply.newBuilder ();
          consumePayload.setToken (token);
          consumePayload.setConsumerTag ((String) result);
          message = new Message (AmqpMessage.CONSUME_REPLY, consumePayload.build ());
          break;
        default:
          break;
      }
    }
View Full Code Here

  public void sendShutdownSignal (final Session session, final String consumerTag, final String errorMessage)
  {
    final AmqpPayloads.ShutdownMessage.Builder downPayload = ShutdownMessage.newBuilder ();
    downPayload.setConsumerTag (consumerTag);
    downPayload.setMessage (errorMessage);
    final Message message = new Message (AmqpMessage.SHUTDOWN, downPayload.build ());
    // NOTE: send response
    this.publishResponse (session, message);
    this.logger.trace ("AmqpResponseTransmitter - Sent Shutdown message");
  }
View Full Code Here

    final CompletionToken token = this.generateToken ();
    this.transcript.traceDebugging ("deleting the record with key `%s` (with request token `%s`)...", key, token.getMessageId ());
    final DeleteRequest.Builder requestBuilder = DeleteRequest.newBuilder ();
    requestBuilder.setToken (token);
    requestBuilder.setKey (key);
    final Message message = new Message (KeyValueMessage.DELETE_REQUEST, requestBuilder.build ());
    return this.sendRequest (message, token, Void.class);
  }
View Full Code Here

  {
    this.transcript.traceDebugging ("destroying the proxy...");
    final CompletionToken token = this.generateToken ();
    final AbortRequest.Builder requestBuilder = AbortRequest.newBuilder ();
    requestBuilder.setToken (token);
    return (this.disconnect (new Message (KeyValueMessage.ABORTED, requestBuilder.build ())));
  }
View Full Code Here

  {
    final CompletionToken token = this.generateToken ();
    this.transcript.traceDebugging ("listing the keys (with request token `%s`)...", token.getMessageId ());
    final ListRequest.Builder requestBuilder = ListRequest.newBuilder ();
    requestBuilder.setToken (token);
    final Message message = new Message (KeyValueMessage.LIST_REQUEST, requestBuilder.build ());
    return ((CallbackCompletion<List<String>>) ((CallbackCompletion<?>) this.sendRequest (message, token, List.class)));
  }
View Full Code Here

    final GetRequest.Builder requestBuilder = GetRequest.newBuilder ();
    requestBuilder.setToken (token);
    requestBuilder.addAllKey (keys);
    final EncodingMetadata encodingMetadata = this.encoder.getExpectedEncodingMetadata ();
    requestBuilder.setEnvelope (this.buildEnvelope (encodingMetadata));
    final Message message = new Message (KeyValueMessage.GET_REQUEST, requestBuilder.build ());
    return (this.sendRequest (message, token, outcomeClass));
  }
View Full Code Here

    } catch (final EncodingException exception) {
      this.exceptions.traceDeferredException (exception, "encoding the value for record with key `%s` failed; deferring!", key);
      result = CallbackCompletion.createFailure (exception);
    }
    if (result == null) {
      final Message message = new Message (KeyValueMessage.SET_REQUEST, requestBuilder.build ());
      result = this.sendRequest (message, token, Void.class);
    }
    return (result);
  }
View Full Code Here

  {
    this.transcript.traceDebugging ("initializing proxy...");
    final InitRequest.Builder requestBuilder = InitRequest.newBuilder ();
    requestBuilder.setToken (this.generateToken ());
    requestBuilder.setBucket (this.bucket);
    return (this.connect (KeyValueSession.CONNECTOR, new Message (KeyValueMessage.ACCESS, requestBuilder.build ())));
  }
View Full Code Here

TOP

Related Classes of eu.mosaic_cloud.interoperability.core.Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.