Package org.cometd.bayeux.server

Examples of org.cometd.bayeux.server.ServerChannel.addListener()


        // There will be a response pending so the case is different
        publishLatch.set(new CountDownLatch(1));
        connectLatch.set(new CountDownLatch(1));
        String serviceChannelName = "/service/test";
        final ServerChannel serviceChannel = bayeux.createChannelIfAbsent(serviceChannelName, new Persistent()).getReference();
        serviceChannel.addListener(new ServerChannel.MessageListener()
        {
            public boolean onMessage(ServerSession from, ServerChannel channel, ServerMessage.Mutable message)
            {
                bayeux.getChannel(channelName).publish(emitter, data);
                return true;
View Full Code Here


        // from the server-side publish
        publishLatch.set(new CountDownLatch(1));
        connectLatch.set(new CountDownLatch(1));
        String serviceChannelName = "/service/test";
        ServerChannel serviceChannel = bayeux.createChannelIfAbsent(serviceChannelName, new Persistent()).getReference();
        serviceChannel.addListener(new ServerChannel.MessageListener()
        {
            public boolean onMessage(ServerSession from, ServerChannel channel, ServerMessage.Mutable message)
            {
                bayeux.getChannel(channelName).publish(emitter, data);
                return true;
View Full Code Here

        // There will be a response pending so the case is different
        publishLatch.set(new CountDownLatch(1));
        connectLatch.set(new CountDownLatch(1));
        String serviceChannelName = "/service/test";
        final ServerChannel serviceChannel = bayeux.createChannelIfAbsent(serviceChannelName, new Persistent()).getReference();
        serviceChannel.addListener(new ServerChannel.MessageListener()
        {
            public boolean onMessage(ServerSession from, ServerChannel channel, ServerMessage.Mutable message)
            {
                bayeux.getChannel(channelName).publish(emitter, data);
                return true;
View Full Code Here

        if (!ServerMessage.class.isAssignableFrom(candidate.getParameterTypes()[1]))
            throw new IllegalArgumentException("Service method '" + methodName + "' does not have " + ServerMessage.class.getName() + " as second parameter");

        ServerChannel channel = _bayeux.createChannelIfAbsent(channelName).getReference();
        Invoker invoker = new Invoker(channelName, candidate);
        channel.addListener(invoker);
        invokers.put(methodName, invoker);
    }

    /**
     * <p>Unmaps the method with the given name that has been mapped to the given channel.</p>
View Full Code Here

        _bayeux.addExtension(_oortExtension);

        ServerChannel oortCloudChannel = _bayeux.createChannelIfAbsent(OORT_CLOUD_CHANNEL).getReference();
        oortCloudChannel.addAuthorizer(GrantAuthorizer.GRANT_ALL);
        oortCloudChannel.addListener(_cloudListener);

        ServerChannel oortServiceChannel = _bayeux.createChannelIfAbsent(OORT_SERVICE_CHANNEL).getReference();
        oortServiceChannel.addListener(_joinListener);

        _oortSession.handshake();
View Full Code Here

        ServerChannel oortCloudChannel = _bayeux.createChannelIfAbsent(OORT_CLOUD_CHANNEL).getReference();
        oortCloudChannel.addAuthorizer(GrantAuthorizer.GRANT_ALL);
        oortCloudChannel.addListener(_cloudListener);

        ServerChannel oortServiceChannel = _bayeux.createChannelIfAbsent(OORT_SERVICE_CHANNEL).getReference();
        oortServiceChannel.addListener(_joinListener);

        _oortSession.handshake();
    }

    @Override
View Full Code Here

        sender.handshake();
        oort.addCometListener(this);
        BayeuxServer bayeuxServer = oort.getBayeuxServer();
        ServerChannel channel = bayeuxServer.createChannelIfAbsent(channelName, this).getReference();
        channel.addListener(messageListener);
        oort.observeChannel(channelName);

        // Notify other nodes of our initial value.
        // Must be done after registering listeners, to avoid missing responses from other nodes.
        channel.publish(getLocalSession(), info);
View Full Code Here

    @Test
    public void testChannelWithListenersIsNotSwept() throws Exception
    {
        String channelName = "/test";
        ServerChannel channel = _bayeux.createChannelIfAbsent(channelName).getReference();
        channel.addListener(new ServerChannel.MessageListener()
        {
            public boolean onMessage(ServerSession from, ServerChannel channel, Mutable message)
            {
                return true;
            }
View Full Code Here

            }
        };

        String channelName1 = "/a/b/c";
        ServerChannel channel1 = _bayeux.createChannelIfAbsent(channelName1).getReference();
        channel1.addListener(listener);

        String wildName1 = "/a/b/*";
        _bayeux.createChannelIfAbsent(wildName1, initializer);

        String wildName2 = "/a/**";
 
View Full Code Here

    };
    this.server.createIfAbsent(this.syncAppChannel, initializer);
    this.server.createIfAbsent(this.syncEngineChannel, initializer);

    ServerChannel sync = server.getChannel(this.syncAppChannel);
    sync.addListener(this);
    sync = server.getChannel(this.syncEngineChannel);
    sync.addListener(this);

    this.sessionModerator = SessionModerator.getInstance(this,
        (String)config.get("sessionModerator"), confKey);
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.