Package eu.mosaic_cloud.components.core

Examples of eu.mosaic_cloud.components.core.ChannelMessage


    Assert.assertTrue (channelController.bind (channelCallbacksProxy).await (BasicChannelTest.defaultPollTimeout));
    final QueueingChannelCallbacks channelCallbacks = QueueingChannelCallbacks.create (channelController, exceptions);
    final CallbackIsolate channelCallbacksIsolate = reactor.createIsolate ();
    Assert.assertTrue (reactor.assignHandler (channelCallbacksProxy, channelCallbacks, channelCallbacksIsolate).await (BasicChannelTest.defaultPollTimeout));
    for (int index = 0; index < BasicChannelTest.defaultTries; index++) {
      final ChannelMessage outboundMessage = RandomMessageGenerator.defaultInstance.generateChannelMessage ();
      Assert.assertTrue (channelController.send (outboundMessage).await (BasicChannelTest.defaultPollTimeout));
      final ChannelMessage inboundMessage = channelCallbacks.queue.poll (BasicChannelTest.defaultPollTimeout, TimeUnit.MILLISECONDS);
      Assert.assertNotNull (inboundMessage);
      Assert.assertEquals (outboundMessage.metaData, inboundMessage.metaData);
      Assert.assertEquals (outboundMessage.data, inboundMessage.data);
    }
    pipe.sink ().close ();
View Full Code Here


    {
      this.transcript.traceDebugging ("executing decoder...");
      final ByteBuffer packet = Threading.poll (this.inboundPackets, this.pollTimeout);
      if (packet != null) {
        this.transcript.traceDebugging ("decoding inbound message...");
        final ChannelMessage message;
        try {
          message = this.coder.decode (packet);
          Preconditions.checkNotNull (message);
        } catch (final Throwable exception) {
          throw (new IgnoredException (exception, "unexpected error encountered while decoding the inbound packet; aborting!"));
View Full Code Here

    @Override
    protected final void loop_1 ()
        throws CaughtException
    {
      this.transcript.traceDebugging ("executing dispatcher...");
      final ChannelMessage message = Threading.poll (this.inboundMessages, this.pollTimeout);
      if (message != null) {
        if (this.inboundActive) {
          this.transcript.traceDebugging ("dispatching received callback...");
          try {
            this.channelCallbacks.received (this.channel.controllerProxy, message);
View Full Code Here

    @Override
    protected void loop_1 ()
        throws CaughtException
    {
      this.transcript.traceDebugging ("executing encoder...");
      final ChannelMessage message = Threading.poll (this.outboundMessages, this.pollTimeout);
      if (message != null) {
        this.transcript.traceDebugging ("encoding outbound message...");
        final ByteBuffer packet;
        try {
          packet = this.coder.encode (message);
View Full Code Here

          else
            throw (new IllegalArgumentException ());
          final String correlation = UUID.randomUUID ().toString ().replace ("-", "");
          metaData.put (Token.Specifications.string, specifications);
          metaData.put (Token.Correlation.string, correlation);
          final ChannelMessage message = ChannelMessage.create (ChannelMessageType.Resources, metaData, ByteBuffer.allocate (0));
          Backend.this.acquires.put (reference, correlation);
          Backend.this.channelController.send (message);
        }
      });
      return (null);
View Full Code Here

          metaData.put (Token.Action.string, Token.Call.string);
          metaData.put (Token.Component.string, identifier.string);
          metaData.put (Token.Operation.string, request.operation);
          metaData.put (Token.Correlation.string, correlation);
          metaData.put (Token.Inputs.string, request.inputs);
          final ChannelMessage message = ChannelMessage.create (ChannelMessageType.Exchange, metaData, request.data);
          Backend.this.outboundCalls.put (request.reference, correlation);
          Backend.this.channelController.send (message);
        }
      });
      return (null);
View Full Code Here

          metaData.put (Token.Ok.string, Boolean.valueOf (reply.ok));
          if (reply.ok)
            metaData.put (Token.Outputs.string, reply.outputsOrError);
          else
            metaData.put (Token.Error.string, reply.outputsOrError);
          final ChannelMessage message = ChannelMessage.create (ChannelMessageType.Exchange, metaData, reply.data.asReadOnlyBuffer ());
          Backend.this.channelController.send (message);
        }
      });
      return (null);
    }
View Full Code Here

          final HashMap<String, Object> metaData = new HashMap<String, Object> ();
          metaData.put (Token.Action.string, Token.Cast.string);
          metaData.put (Token.Component.string, identifier.string);
          metaData.put (Token.Operation.string, request.operation);
          metaData.put (Token.Inputs.string, request.inputs);
          final ChannelMessage message = ChannelMessage.create (ChannelMessageType.Exchange, metaData, request.data);
          Backend.this.channelController.send (message);
        }
      });
      return (null);
    }
View Full Code Here

          final String correlation = UUID.randomUUID ().toString ().replace ("-", "");
          final HashMap<String, Object> metaData = new HashMap<String, Object> ();
          metaData.put (Token.Action.string, Token.Register.string);
          metaData.put (Token.Group.string, identifier.string);
          metaData.put (Token.Correlation.string, correlation);
          final ChannelMessage message = ChannelMessage.create (ChannelMessageType.Exchange, metaData, ByteBuffer.allocate (0));
          Backend.this.registers.put (reference, correlation);
          Backend.this.channelController.send (message);
        }
      });
      return (null);
View Full Code Here

    if ("exchange".equals (ChannelMessageType.Exchange.identifier))
      messageType = ChannelMessageType.Exchange;
    else
      messageType = null;
    Preconditions.checkArgument (messageType != null, "invalid message type: `%s`", messageTypeValue);
    final ChannelMessage message = ChannelMessage.create (messageType, metaData, packet);
    return (message);
  }
View Full Code Here

TOP

Related Classes of eu.mosaic_cloud.components.core.ChannelMessage

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.