Search in sources :

Example 1 with PulsarChannelInitializer

use of org.apache.pulsar.broker.service.PulsarChannelInitializer in project pulsar by yahoo.

the class LookupRetryTest 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 {
                        connectionsCreated.incrementAndGet();
                        return new ErrorByTopicServerCnx(pulsar, failureMap);
                    }
                };
            });
            return broker;
        }
    };
}
Also used : PulsarChannelInitializer(org.apache.pulsar.broker.service.PulsarChannelInitializer) PulsarService(org.apache.pulsar.broker.PulsarService) BrokerService(org.apache.pulsar.broker.service.BrokerService)

Example 2 with PulsarChannelInitializer

use of org.apache.pulsar.broker.service.PulsarChannelInitializer in project incubator-pulsar by apache.

the class LookupRetryTest 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 {
                        connectionsCreated.incrementAndGet();
                        return new ErrorByTopicServerCnx(pulsar, failureMap);
                    }
                };
            });
            return broker;
        }
    };
}
Also used : PulsarChannelInitializer(org.apache.pulsar.broker.service.PulsarChannelInitializer) PulsarService(org.apache.pulsar.broker.PulsarService) BrokerService(org.apache.pulsar.broker.service.BrokerService)

Example 3 with PulsarChannelInitializer

use of org.apache.pulsar.broker.service.PulsarChannelInitializer in project incubator-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)

Example 4 with PulsarChannelInitializer

use of org.apache.pulsar.broker.service.PulsarChannelInitializer in project pulsar by yahoo.

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)

Example 5 with PulsarChannelInitializer

use of org.apache.pulsar.broker.service.PulsarChannelInitializer 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)6 BrokerService (org.apache.pulsar.broker.service.BrokerService)6 PulsarChannelInitializer (org.apache.pulsar.broker.service.PulsarChannelInitializer)6 ServerCnx (org.apache.pulsar.broker.service.ServerCnx)3 CommandFlow (org.apache.pulsar.common.api.proto.CommandFlow)3