Package net.engio.mbassy.bus.common

Examples of net.engio.mbassy.bus.common.IMessageBus.post()


            bus.subscribe(handler);
        }

        MessagePublication publication = null;
        for(int i = 0; i < numberOfMessages; i++){
           publication =  bus.post(new Object()).asynchronously();
        }
        // wait for last publication
        while (!publication.isFinished()){
            pause(100);
        }
View Full Code Here


            handlers.add(handler);
            bus.subscribe(handler);
        }

        for(int i = 0; i < numberOfMessages; i++){
            track(bus.post(new Object()).asynchronously());
        }

        pause(10000);

        for(SynchronizedWithAsynchronousDelivery handler : handlers){
View Full Code Here

        for(int i = 0; i < messages.length ; i++){
             messages[i] = i;
        }
        // publish in ascending order
        for(Integer message : messages)
            fifoBUs.post(message).asynchronously();

        while(fifoBUs.hasPendingMessages())
            pause(1000);

        for(SyncListener listener : listeners){
View Full Code Here

        for(int i = 0; i < messages.length ; i++){
            messages[i] = i;
        }
        // publish in ascending order
        for(Integer message : messages)
            fifoBUs.post(message).asynchronously();

        while(fifoBUs.hasPendingMessages())
            pause(2000);

        for(SyncAsyncListener listener : listeners){
View Full Code Here

    @Test
    public void testDispatch1(){
        IMessageBus bus = createBus(SyncAsync());
        EventListener2 listener2 = new EventListener2();
        bus.subscribe(listener2);
        bus.post("jfndf").now();
        assertTrue(listener2Called);
        assertFalse(listener1Called);

        EventListener1 listener1 = new EventListener1();
        bus.subscribe(listener1);
View Full Code Here

        assertTrue(listener2Called);
        assertFalse(listener1Called);

        EventListener1 listener1 = new EventListener1();
        bus.subscribe(listener1);
        bus.post("jfndf").now();
        assertTrue(listener1Called);
    }

}
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.