Package eu.mosaic_cloud.platform.core.utils.DataEncoder

Examples of eu.mosaic_cloud.platform.core.utils.DataEncoder.EncodeOutcome


    byte[] data = null;
    String contentType = null;
    String contentEncoding = null;
    CallbackCompletion<Void> result = null;
    try {
      final EncodeOutcome outcome = this.messageEncoder.encode (message, null);
      data = outcome.data;
      if (outcome.metadata.hasContentEncoding () && !EncodingMetadata.ANY.hasSameContentEncoding (outcome.metadata)) {
        contentEncoding = outcome.metadata.getContentEncoding ();
      }
      if (outcome.metadata.hasContentType () && !EncodingMetadata.ANY.hasSameContentType (outcome.metadata)) {
View Full Code Here


    final String exchange = ConfigUtils.resolveParameter (configuration, "publisher.amqp.exchange", String.class, "");
    final String routingKey = ConfigUtils.resolveParameter (configuration, "publisher.amqp.routing_key", String.class, "");
    final boolean manadatory = ConfigUtils.resolveParameter (configuration, "publisher.amqp.manadatory", Boolean.class, true);
    final boolean immediate = ConfigUtils.resolveParameter (configuration, "publisher.amqp.immediate", Boolean.class, true);
    final boolean durable = ConfigUtils.resolveParameter (configuration, "publisher.amqp.durable", Boolean.class, false);
    final EncodeOutcome encode = this.encoder.encode (this.sentMessage, null);
    final AmqpOutboundMessage mssg = new AmqpOutboundMessage (exchange, routingKey, encode.data, manadatory, immediate, durable, null, encode.metadata.getContentEncoding (), encode.metadata.getContentType (), null, null);
    Assert.assertTrue (this.awaitSuccess (this.connector.publish (mssg)));
  }
View Full Code Here

      }
      final JSONObject metadata = new JSONObject ();
      final EncodingMetadata httpBodyEncodingMetadata = new EncodingMetadata (bodyContentType, bodyContentEncoding);
      final byte[] httpBodyBytes;
      try {
        final EncodeOutcome outcome = this.responseBodyEncoder.encode (response.body, httpBodyEncodingMetadata);
        httpBodyBytes = outcome.data;
      } catch (final EncodingException exception) {
        throw (new EncodingException ("invalid body", exception));
      }
      metadata.put ("version", 1);
View Full Code Here

    requestBuilder.setToken (token);
    requestBuilder.setKey (key);
    requestBuilder.setExpTime (exp);
    CallbackCompletion<Void> result = null;
    try {
      final EncodeOutcome outcome = this.encoder.encode (data, null);
      requestBuilder.setValue (ByteString.copyFrom (outcome.data));
      requestBuilder.setEnvelope (this.buildEnvelope (outcome.metadata));
    } catch (final EncodingException exception) {
      this.exceptions.traceDeferredException (exception, "encoding the value for record with key `%s` failed; deferring!", key);
      result = CallbackCompletion.createFailure (exception);
View Full Code Here

    requestBuilder.setToken (token);
    requestBuilder.setKey (key);
    requestBuilder.setExpTime (exp);
    CallbackCompletion<Void> result = null;
    try {
      final EncodeOutcome outcome = this.encoder.encode (data, null);
      requestBuilder.setValue (ByteString.copyFrom (outcome.data));
      requestBuilder.setEnvelope (this.buildEnvelope (outcome.metadata));
    } catch (final EncodingException exception) {
      this.exceptions.traceDeferredException (exception, "encoding the value for record with key `%s` failed; deferring!", key);
      result = CallbackCompletion.createFailure (exception);
View Full Code Here

    final MemcachedPayloads.AppendRequest.Builder requestBuilder = MemcachedPayloads.AppendRequest.newBuilder ();
    requestBuilder.setToken (token);
    requestBuilder.setKey (key);
    CallbackCompletion<Void> result = null;
    try {
      final EncodeOutcome outcome = this.encoder.encode (data, null);
      requestBuilder.setValue (ByteString.copyFrom (outcome.data));
      requestBuilder.setEnvelope (this.buildEnvelope (outcome.metadata));
    } catch (final EncodingException exception) {
      this.exceptions.traceDeferredException (exception, "encoding the value for record with key `%s` failed; deferring!", key);
      result = CallbackCompletion.createFailure (exception);
View Full Code Here

    final MemcachedPayloads.CasRequest.Builder requestBuilder = MemcachedPayloads.CasRequest.newBuilder ();
    requestBuilder.setToken (token);
    requestBuilder.setKey (key);
    CallbackCompletion<Void> result = null;
    try {
      final EncodeOutcome outcome = this.encoder.encode (data, null);
      requestBuilder.setValue (ByteString.copyFrom (outcome.data));
      requestBuilder.setEnvelope (this.buildEnvelope (outcome.metadata));
    } catch (final EncodingException exception) {
      this.exceptions.traceDeferredException (exception, "encoding the value for record with key `%s` failed; deferring!", key);
      result = CallbackCompletion.createFailure (exception);
View Full Code Here

    final MemcachedPayloads.PrependRequest.Builder requestBuilder = MemcachedPayloads.PrependRequest.newBuilder ();
    requestBuilder.setToken (token);
    requestBuilder.setKey (key);
    CallbackCompletion<Void> result = null;
    try {
      final EncodeOutcome outcome = this.encoder.encode (data, null);
      requestBuilder.setValue (ByteString.copyFrom (outcome.data));
      requestBuilder.setEnvelope (this.buildEnvelope (outcome.metadata));
    } catch (final EncodingException exception) {
      this.exceptions.traceDeferredException (exception, "encoding the value for record with key `%s` failed; deferring!", key);
      result = CallbackCompletion.createFailure (exception);
View Full Code Here

    requestBuilder.setToken (token);
    requestBuilder.setKey (key);
    requestBuilder.setExpTime (exp);
    CallbackCompletion<Void> result = null;
    try {
      final EncodeOutcome outcome = this.encoder.encode (data, null);
      requestBuilder.setValue (ByteString.copyFrom (outcome.data));
      requestBuilder.setEnvelope (this.buildEnvelope (outcome.metadata));
    } catch (final EncodingException exception) {
      this.exceptions.traceDeferredException (exception, "encoding the value for record with key `%s` failed; deferring!", key);
      result = CallbackCompletion.createFailure (exception);
View Full Code Here

    final String exchange = ConfigUtils.resolveParameter (AmqpDriverTest.configuration, "publisher.amqp.exchange", String.class, "");
    final String routingKey = ConfigUtils.resolveParameter (AmqpDriverTest.configuration, "publisher.amqp.routing_key", String.class, "");
    final boolean manadatory = ConfigUtils.resolveParameter (AmqpDriverTest.configuration, "publisher.amqp.manadatory", Boolean.class, true);
    final boolean immediate = ConfigUtils.resolveParameter (AmqpDriverTest.configuration, "publisher.amqp.immediate", Boolean.class, true);
    final boolean durable = ConfigUtils.resolveParameter (AmqpDriverTest.configuration, "publisher.amqp.durable", Boolean.class, false);
    final EncodeOutcome encode = this.encoder.encode (this.sentMessage, null);
    final AmqpOutboundMessage mssg = new AmqpOutboundMessage (exchange, routingKey, encode.data, manadatory, immediate, durable, null, encode.metadata.getContentEncoding (), encode.metadata.getContentType (), null, null);
    final IOperationCompletionHandler<Boolean> handler = new TestLoggingHandler<Boolean> ("publish message");
    final IResult<Boolean> r = this.wrapper.basicPublish (this.clientId, mssg, handler);
    Assert.assertTrue (r.getResult ());
  }
View Full Code Here

TOP

Related Classes of eu.mosaic_cloud.platform.core.utils.DataEncoder.EncodeOutcome

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.