Search in sources :

Example 1 with CommandFlow

use of org.apache.pulsar.common.api.proto.CommandFlow in project pulsar by apache.

the class NonDurableSubscriptionTest method newPulsarService.

@Override
protected PulsarService newPulsarService(ServiceConfiguration conf) throws Exception {
    return new PulsarService(conf) {

        @Override
        protected BrokerService newBrokerService(PulsarService pulsar) throws Exception {
            BrokerService broker = new BrokerService(this, ioEventLoopGroup);
            broker.setPulsarChannelInitializerFactory((_pulsar, opts) -> {
                return new PulsarChannelInitializer(_pulsar, opts) {

                    @Override
                    protected ServerCnx newServerCnx(PulsarService pulsar, String listenerName) throws Exception {
                        return new ServerCnx(pulsar) {

                            @Override
                            protected void handleFlow(CommandFlow flow) {
                                super.handleFlow(flow);
                                numFlow.incrementAndGet();
                            }
                        };
                    }
                };
            });
            return broker;
        }
    };
}
Also used : PulsarChannelInitializer(org.apache.pulsar.broker.service.PulsarChannelInitializer) CommandFlow(org.apache.pulsar.common.api.proto.CommandFlow) PulsarService(org.apache.pulsar.broker.PulsarService) ServerCnx(org.apache.pulsar.broker.service.ServerCnx) BrokerService(org.apache.pulsar.broker.service.BrokerService)

Aggregations

PulsarService (org.apache.pulsar.broker.PulsarService)1 BrokerService (org.apache.pulsar.broker.service.BrokerService)1 PulsarChannelInitializer (org.apache.pulsar.broker.service.PulsarChannelInitializer)1 ServerCnx (org.apache.pulsar.broker.service.ServerCnx)1 CommandFlow (org.apache.pulsar.common.api.proto.CommandFlow)1