Package org.cometd.bayeux.client

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


        session1.batch(new Runnable()
        {
            public void run()
            {
                ClientSessionChannel foobar1=session1.getChannel("/foo/bar");
                foobar1.publish("part1");
                Assert.assertEquals(null,events.poll());
                foobar1.publish("part2");
            }
        });
View Full Code Here


            public void run()
            {
                ClientSessionChannel foobar1=session1.getChannel("/foo/bar");
                foobar1.publish("part1");
                Assert.assertEquals(null,events.poll());
                foobar1.publish("part2");
            }
        });

        Assert.assertEquals(session1.getId(),events.poll());
        Assert.assertEquals("part1",events.poll());
View Full Code Here

        client.handshake();
        assertTrue(client.waitFor(5000, BayeuxClient.State.CONNECTED));

        final AtomicReference<CountDownLatch> latch = new AtomicReference<>(new CountDownLatch(1));
        ClientSessionChannel channel = client.getChannel("/test");
        channel.publish(new HashMap(), new ClientSessionChannel.MessageListener()
        {
            public void onMessage(ClientSessionChannel channel, Message message)
            {
                Assert.assertTrue(message.isSuccessful());
                latch.get().countDown();
View Full Code Here

        Assert.assertTrue(latch.get().await(5, TimeUnit.SECONDS));

        // Publish again without callback, must not trigger the previous callback
        latch.set(new CountDownLatch(1));
        channel.publish(new HashMap());

        Assert.assertFalse(latch.get().await(1, TimeUnit.SECONDS));

        disconnectBayeuxClient(client);
    }
View Full Code Here

        client.handshake();
        assertTrue(client.waitFor(5000, BayeuxClient.State.CONNECTED));

        final AtomicReference<CountDownLatch> latch = new AtomicReference<>(new CountDownLatch(1));
        ClientSessionChannel channel = client.getChannel("/test");
        channel.publish(new HashMap(), new ClientSessionChannel.MessageListener()
        {
            public void onMessage(ClientSessionChannel channel, Message message)
            {
                Assert.assertFalse(message.isSuccessful());
                latch.get().countDown();
View Full Code Here

        BayeuxClient client = newBayeuxClient();
        client.handshake();

        final AtomicReference<CountDownLatch> latch = new AtomicReference<>(new CountDownLatch(1));
        ClientSessionChannel channel = client.getChannel("/test");
        channel.publish(new HashMap(), new ClientSessionChannel.MessageListener()
        {
            public void onMessage(ClientSessionChannel channel, Message message)
            {
                Assert.assertFalse(message.isSuccessful());
                latch.get().countDown();
View Full Code Here

        server.stop();

        final AtomicReference<CountDownLatch> latch = new AtomicReference<CountDownLatch>(new CountDownLatch(1));
        ClientSessionChannel channel = client.getChannel("/test");
        channel.publish(new HashMap(), new ClientSessionChannel.MessageListener()
        {
            public void onMessage(ClientSessionChannel channel, Message message)
            {
                Assert.assertFalse(message.isSuccessful());
                latch.get().countDown();
View Full Code Here

                        clientLatch.countDown();
                    }
                });
                Map<String, Object> data = new HashMap<>();
                data.put("publish", true);
                channel.publish(data);
            }
        });

        Assert.assertTrue(localLatch.await(5, TimeUnit.SECONDS));
        Assert.assertTrue(clientLatch.await(5, TimeUnit.SECONDS));
View Full Code Here

            message.put("chat", chat);
            // Mandatory fields to record latencies
            message.put(START_FIELD, System.nanoTime());
            message.put(ID_FIELD, String.valueOf(ids.incrementAndGet()));
            ClientSessionChannel clientChannel = client.getChannel(getChannelId(channel + "/" + room));
            clientChannel.publish(message);
            clientChannel.release();
            expected += clientsPerRoom.get();
        }
        client.endBatch();
View Full Code Here

        private void notifyServer(String channelName) throws InterruptedException
        {
            final CountDownLatch latch = new CountDownLatch(1);
            ClientSessionChannel channel = getChannel(channelName);
            channel.publish(new HashMap<String, Object>(1), new ClientSessionChannel.MessageListener()
            {
                public void onMessage(ClientSessionChannel channel, Message message)
                {
                    latch.countDown();
                }
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.