Examples of subscribe()


Examples of org.axonframework.commandhandling.SimpleCommandBus.subscribe()

        // a CommandGateway has a much nicer API
        CommandGateway commandGateway = new DefaultCommandGateway(commandBus);

        // let's register a Command Handler that writes to System Out so we can see what happens
        commandBus.subscribe(MarkToDoItemOverdueCommand.class.getName(),
                new CommandHandler<MarkToDoItemOverdueCommand>() {
                    @Override
                    public Object handle(CommandMessage<MarkToDoItemOverdueCommand> commandMessage,
                                         UnitOfWork unitOfWork) throws Throwable {
                        System.out.println(String.format("Got command to mark [%s] overdue!",
View Full Code Here

Examples of org.axonframework.eventhandling.Cluster.subscribe()

    @Test
    public void testCustomOrderedClusterBean() {
        Cluster cluster = applicationContext.getBean("customOrderedCluster", Cluster.class);
        final EventListener listener = mock(EventListener.class);
        final EventListener listener2 = mock(EventListener.class);
        cluster.subscribe(listener);
        cluster.subscribe(listener2);
        OrderResolver mockOrderResolver = applicationContext.getBean("orderResolver", OrderResolver.class);
        verify(mockOrderResolver, atLeastOnce()).orderOf(listener);
        verify(mockOrderResolver, atLeastOnce()).orderOf(listener2);
    }
View Full Code Here

Examples of org.axonframework.eventhandling.ClusteringEventBus.subscribe()

        ));

        // create the event bus and subscribe two listeners
        // notice how the registration process itself is unaware of clustering
        EventBus eventBus = new ClusteringEventBus(clusterSelector);
        eventBus.subscribe(new AnnotationEventListenerAdapter(new ThreadPrintingEventListener()));
        eventBus.subscribe(new AnnotationEventListenerAdapter(new AnotherThreadPrintingEventListener()));

        // publish an event
        eventBus.publish(asEventMessage(new ToDoItemCompletedEvent("todo1")));
View Full Code Here

Examples of org.axonframework.eventhandling.EventBus.subscribe()

        ));

        // create the event bus and subscribe two listeners
        // notice how the registration process itself is unaware of clustering
        EventBus eventBus = new ClusteringEventBus(clusterSelector);
        eventBus.subscribe(new AnnotationEventListenerAdapter(new ThreadPrintingEventListener()));
        eventBus.subscribe(new AnnotationEventListenerAdapter(new AnotherThreadPrintingEventListener()));

        // publish an event
        eventBus.publish(asEventMessage(new ToDoItemCompletedEvent("todo1")));
View Full Code Here

Examples of org.axonframework.eventhandling.SimpleEventBus.subscribe()

                new CreateToDoCommandHandler(repository));
        commandBus.subscribe(MarkCompletedCommand.class.getName(),
                new MarkCompletedCommandHandler(repository));

        // We register an event listener to see which events are created
        eventBus.subscribe(new ToDoEventListener());

        // and let's send some Commands on the CommandBus using the special runner configured with our CommandGateway.
        CommandGenerator.sendCommands(commandGateway);
    }
}
View Full Code Here

Examples of org.axonframework.saga.annotation.AnnotatedSagaManager.subscribe()

        // Sagas instances are managed and tracked by a SagaManager.
        AnnotatedSagaManager sagaManager = new AnnotatedSagaManager(sagaRepository, sagaFactory,
                eventBus, ToDoSaga.class);

        // and we need to subscribe the Saga Manager to the Event Bus
        sagaManager.subscribe();

        // That's the infrastructure we need...
        // Let's pretend a few things are happening

        // We create 2 items
View Full Code Here

Examples of org.cometd.Channel.subscribe()

        if (((ChannelImpl)channel).getChannelId().isWild())
        {
            final Method m=method;
            Client wild_client=_bayeux.newClient(_name + "-wild");
            wild_client.addListener(_listener instanceof MessageListener.Asynchronous?new AsyncWildListen(wild_client,m):new SyncWildListen(wild_client,m));
            channel.subscribe(wild_client);
        }
        else
        {
            _methods.put(channelId,method);
            channel.subscribe(_client);
View Full Code Here

Examples of org.cometd.bayeux.client.ClientSessionChannel.subscribe()

            }
        };
        client.getChannel(META_SUBSCRIBE).addListener(subscriptionListener);

        try {
            clientChannel.subscribe(listener);

            // confirm that a subscription was created
            try {
                if (!latch.await(CHANNEL_TIMEOUT, SECONDS)) {
                    String message;
View Full Code Here

Examples of org.cspoker.server.embedded.chat.room.TableChatRoom.subscribe()

    TableChatRoom room=tables.get(id);
    if(room==null)
      throw new IllegalArgumentException("There exists no table with the given id!");
    if(room.getTable().hasAsJoinedPlayer(id2)){
      // only players who joined the table, are allowed to subscribe their listener
      room.subscribe(chatlistener);
    }
  }
 
  public void unsubscribe(ChatListener chatlistener, TableId id, PlayerId id2) {
    if(id==null)
View Full Code Here

Examples of org.directwebremoting.Hub.subscribe()

            subscriptions = new HashMap<String, BrowserMessageListener>();
        }
        subscriptions.put(subscriptionId, subscription);
        session.setAttribute(ATTRIBUTE_SUBSCRIPTIONS, subscriptions);

        hub.subscribe(subscription.topic, subscription);
    }

    /**
     * Stop notifications of against a subscription id
     * @param subscriptionId The ID to pass back to link to client side data
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.