Package org.jboss.errai.bus.client.api.messaging

Examples of org.jboss.errai.bus.client.api.messaging.MessageCallback


                                  final MessageCallback callback,
                                  final boolean local,
                                  final WrappedCallbackHolder callbackHolder) {
    final boolean isNew = !isSubscribed(subject);

    final MessageCallback cb = new MessageCallback() {
      @Override
      public void callback(final Message message) {
        try {
          callback.callback(message);
        }
View Full Code Here


        final String errorTo =
            message.getSubject() + "." + message.getCommandType() + ":" + id + ":Errors:RPC";

        if (remoteCallback != null) {
          bus.subscribe(replyTo,
              new MessageCallback() {
                @Override
                public void callback(Message message) {
                  bus.unsubscribeAll(replyTo);
                  if (DefaultRemoteCallBuilder.this.message.getErrorCallback() != null) {
                    bus.unsubscribeAll(errorTo);
                  }
                  remoteCallback.callback(message.get(responseType, "MethodReply"));
                }
              }
          );
          message.set(MessageParts.ReplyTo, replyTo);
        }

        if (message.getErrorCallback() != null) {
          bus.subscribe(errorTo,
              new MessageCallback() {
                @Override
                public void callback(Message m) {
                  bus.unsubscribeAll(errorTo);
                  if (remoteCallback != null) {
                    bus.unsubscribeAll(replyTo);
View Full Code Here

  public SSEHandler(final ClientMessageBusImpl clientMessageBus) {
    this.clientMessageBus = clientMessageBus;
    this.pollingHandler = HttpPollingHandler.newNoPollingInstance(clientMessageBus);

    sseAgentSubscription = clientMessageBus.subscribe(SSE_AGENT_SERVICE, new MessageCallback() {
      @Override
      public void callback(final Message message) {
        notifyConnected();
      }
    });
View Full Code Here

/**
* @author Mike Brock
*/
public class ServerOTBusService {
  public static void startOTService(final MessageBus messageBus, final OTEngine engine) {
    messageBus.subscribe("ServerOTEngine", new MessageCallback() {

      @Override
      public void callback(final Message message) {
        final OpDto value = message.getValue(OpDto.class);
        final QueueSession queueSession = message.getResource(QueueSession.class, "Session");
        final String session = queueSession.getSessionId();
        final OTPeer peer = engine.getPeerState().getPeer(session);

        if (peer == null) {
          System.out.println("SessionID: " + session);
          System.out.println("No session for: " + message.getParts());
          return;
        }

        if (value == null && message.hasPart("PurgeHint")) {
          final Integer purgeHint = message.get(Integer.class, "PurgeHint");
          final Integer entityId = message.get(Integer.class, "EntityId");

          peer.setLastKnownRemoteSequence(entityId, purgeHint);
        }
        else if (value != null) {
          final OTEntity entity = engine.getEntityStateSpace().getEntity(value.getEntityId());
          if (entity == null) {
            return;
          }
          synchronized (entity) {
            ClientDemuxer demux = LocalContext.get(queueSession).getAttribute(ClientDemuxer.class);
            if (demux == null) {
              LocalContext.get(queueSession).setAttribute(ClientDemuxer.class, demux = new ClientDemuxer());
            }

         //   final Collection<OpDto> enginePlanFor = demux.getEnginePlanFor(value);
            for (final OpDto operation : Collections.singletonList(value)) {

              final OTOperation remoteOp = operation.otOperation(engine);

              OTLogUtil.log("RECV", "<<from: " + remoteOp.getAgentId() + ">>" ,
                  "REMOTE", "Server", operation.getRevision(),
                  "\"" + String.valueOf(entity.getState().get()) + "\"");

              if (!engine.receive(session, remoteOp)) {
                System.out.println("*** WARNING: CORRUPT PATHS - MUST RESYNC ALL ***");
                engine.getPeerState().forceResyncAll(entity);
              }
            }
          }
        }
      }
    });

    messageBus.subscribe("ServerOTEngineSyncService", new MessageCallback() {
      @Override
      public void callback(final Message message) {
        final Integer entityId = message.getValue(Integer.class);

        final QueueSession queueSession = message.getResource(QueueSession.class, "Session");
View Full Code Here

public class ClientOTBusService {
 
  private static final Logger logger = LoggerFactory.getLogger(ClientOTBusService.class);

  public static void startOTService(final MessageBus messageBus, final OTEngine engine) {
    messageBus.subscribe("ClientOTEngineSyncService", new MessageCallback() {
      @Override
      public void callback(Message message) {
        final Integer value = message.getValue(Integer.class);
        final OTPeer peer = engine.getPeerState().getPeer("<ServerEngine>");

        peer.beginSyncRemoteEntity("<ServerEngine>", value, new StateEntitySyncCompletionCallback(engine, value,
            new EntitySyncCompletionCallback<State>() {
              @Override
              public void syncComplete(OTEntity<State> entity) {
                engine.getPeerState().notifyResync(entity);
              }
            }));
      }
    });

    messageBus.subscribe("ClientOTEngine", new MessageCallback() {
      @Override
      public void callback(Message message) {
        final OpDto opDto = message.getValue(OpDto.class);

        if (opDto == null && message.hasPart("PurgeHint")) {
View Full Code Here

                RPCEndpointFactory.createEndpointFor(genericSvc, method, bus));
      }
    }

    final RemoteServiceCallback delegate = new RemoteServiceCallback(epts);
    bus.subscribe(remoteIface.getName() + ":RPC", new MessageCallback() {
      @Override
      public void callback(final Message message) {
        delegate.callback(message);
      }
    });
View Full Code Here

        registered.remove(delegateClass);
       
        for (final ServiceParser svcParser : managedTypes.getDelegateServices(delegateClass)) {
          final Object delegateInstance = CDIServerUtil.lookupBean(beanManager, delegateClass, getQualifiers(delegateClass));
          final MessageCallback callback = svcParser.getCallback(delegateInstance, bus);
         
          if (callback != null) {
            if (svcParser.isLocal()) {
              bus.subscribeLocal(svcParser.getServiceName(), callback);
            }
View Full Code Here

                RPCEndpointFactory.createEndpointFor(genericSvc, method, bus));
      }
    }

    final RemoteServiceCallback delegate = new RemoteServiceCallback(epts);
    bus.subscribe(remoteIface.getName() + ":RPC", new MessageCallback() {
      @Override
      public void callback(final Message message) {
        delegate.callback(message);
      }
    });
View Full Code Here

        registered.remove(delegateClass);
       
        for (final ServiceParser svcParser : managedTypes.getDelegateServices(delegateClass)) {
          final Object delegateInstance = CDIServerUtil.lookupBean(beanManager, delegateClass, getQualifiers(delegateClass));
          final MessageCallback callback = svcParser.getCallback(delegateInstance, bus);
         
          if (callback != null) {
            if (svcParser.isLocal()) {
              bus.subscribeLocal(svcParser.getServiceName(), callback);
            }
View Full Code Here

        final Service svc = method.getAnnotation(Service.class);
        final String svcName = svc.value().equals("") ? method.getJavaMember().getName() : svc.value();

        final Method callMethod = method.getJavaMember();

        bus.subscribe(svcName, new MessageCallback() {

          @Override
          public void callback(final Message message) {
            final Object targetBean = CDIServerUtil.lookupBean(beanManager, type);
View Full Code Here

TOP

Related Classes of org.jboss.errai.bus.client.api.messaging.MessageCallback

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.