Package eu.mosaic_cloud.platform.interop.idl.IdlCommon

Examples of eu.mosaic_cloud.platform.interop.idl.IdlCommon.Envelope


        final boolean immediate = publish.getImmediate ();
        final boolean mandatory = publish.getMandatory ();
        routingKey = publish.getRoutingKey ();
        String correlationId = null;
        String replyTo = null;
        final Envelope envelope = publish.getEnvelope ();
        if (publish.hasCorrelationId ()) {
          correlationId = publish.getCorrelationId ();
        }
        if (publish.hasReplyTo ()) {
          replyTo = publish.getReplyTo ();
        }
        final AmqpOutboundMessage mssg = new AmqpOutboundMessage (exchange, routingKey, dataBytes, mandatory, immediate, durable, replyTo, envelope.getContentEncoding (), envelope.getContentType (), correlationId, null);
        AmqpStub.logger.trace ("AmqpStub - Received request for PUBLISH"); // $NON-NLS-1$
        // NOTE: execute operation
        final DriverOperationFinishedHandler pubHandler = new DriverOperationFinishedHandler (token, session);
        resultBool = driver.basicPublish (token.getClientId (), mssg, pubHandler);
        pubHandler.setDetails (AmqpOperations.PUBLISH, resultBool);
View Full Code Here


        final Class<?> outcomeClass = this.pendingRequests.peek (token.getMessageId ()).future.outcomeClass;
        final Object outcome;
        if (outcomeClass == Map.class) {
          final Map<String, TValue> values = new HashMap<String, TValue> ();
          for (final KVEntry entry : resultEntries) {
            final Envelope envelope = entry.getEnvelope ();
            final EncodingMetadata encodingMetadata = new EncodingMetadata (envelope.getContentType (), envelope.getContentEncoding ());
            final TValue value;
            final byte[] rawValue = resultEntries.get (0).getValue ().toByteArray ();
            if ((rawValue != null) && (rawValue.length > 0)) {
              try {
                value = this.encoder.decode (rawValue, encodingMetadata);
              } catch (final EncodingException exception) {
                this.exceptions.traceDeferredException (exception, "decoding the value for record failed; deferring!");
                this.pendingRequests.fail (token.getMessageId (), exception);
                break;
              }
            } else {
              value = null;
            }
            values.put (entry.getKey (), value);
          }
          outcome = values;
        } else if (outcomeClass == Object.class) {
          final TValue value;
          if (!resultEntries.isEmpty ()) {
            final byte[] rawValue = resultEntries.get (0).getValue ().toByteArray ();
            if ((rawValue != null) && (rawValue.length > 0)) {
              final Envelope envelope = resultEntries.get (0).getEnvelope ();
              final EncodingMetadata encodingMetadata = new EncodingMetadata (envelope.getContentType (), envelope.getContentEncoding ());
              try {
                value = this.encoder.decode (rawValue, encodingMetadata);
              } catch (final EncodingException exception) {
                this.exceptions.traceDeferredException (exception, "decoding the value for record failed; deferring!");
                this.pendingRequests.fail (token.getMessageId (), exception);
View Full Code Here

TOP

Related Classes of eu.mosaic_cloud.platform.interop.idl.IdlCommon.Envelope

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.