org.springframework.messaging.support.AbstractSubscribableChannel Java Examples
The following examples show how to use
org.springframework.messaging.support.AbstractSubscribableChannel.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpringWebSocketTest.java From java-specialagent with Apache License 2.0 | 6 votes |
@Test public void testInterceptors(final MockTracer tracer) { final DelegatingWebSocketMessageBrokerConfiguration configuration = new DelegatingWebSocketMessageBrokerConfiguration(); final AbstractSubscribableChannel inboundChannel = configuration.clientInboundChannel(); inboundChannel.setBeanName("clientInboundChannel"); final AbstractSubscribableChannel outboundChannel = configuration.clientOutboundChannel(); outboundChannel.setBeanName("clientOutboundChannel"); outboundChannel.subscribe(new SubProtocolWebSocketHandler(inboundChannel, outboundChannel)); inboundChannel.subscribe(new SubProtocolWebSocketHandler(inboundChannel, outboundChannel)); configuration.clientInboundChannelExecutor().initialize(); configuration.clientOutboundChannelExecutor().initialize(); final Map<String,Object> headers = Collections.<String,Object>singletonMap("simpMessageType", SimpMessageType.MESSAGE); final GenericMessage<String> message = new GenericMessage<>("test", headers); outboundChannel.send(message); inboundChannel.send(message); await().atMost(15, TimeUnit.SECONDS).until(TestUtil.reportedSpansSize(tracer), equalTo(2)); assertEquals(2, tracer.finishedSpans().size()); }
Example #2
Source File: MessageBrokerConfigurationTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void clientOutboundChannelCustomized() { ApplicationContext context = loadConfig(CustomConfig.class); AbstractSubscribableChannel channel = context.getBean( "clientOutboundChannel", AbstractSubscribableChannel.class); assertEquals(4, channel.getInterceptors().size()); ThreadPoolTaskExecutor taskExecutor = context.getBean( "clientOutboundChannelExecutor", ThreadPoolTaskExecutor.class); assertEquals(21, taskExecutor.getCorePoolSize()); assertEquals(22, taskExecutor.getMaxPoolSize()); assertEquals(23, taskExecutor.getKeepAliveSeconds()); SimpleBrokerMessageHandler broker = context.getBean("simpleBrokerMessageHandler", SimpleBrokerMessageHandler.class); assertTrue(broker.isPreservePublishOrder()); }
Example #3
Source File: MessageBrokerConfigurationTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void brokerChannelCustomized() { ApplicationContext context = loadConfig(CustomConfig.class); AbstractSubscribableChannel channel = context.getBean( "brokerChannel", AbstractSubscribableChannel.class); assertEquals(4, channel.getInterceptors().size()); ThreadPoolTaskExecutor taskExecutor = context.getBean( "brokerChannelExecutor", ThreadPoolTaskExecutor.class); assertEquals(31, taskExecutor.getCorePoolSize()); assertEquals(32, taskExecutor.getMaxPoolSize()); assertEquals(33, taskExecutor.getKeepAliveSeconds()); }
Example #4
Source File: MessageBrokerConfigurationTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void brokerChannelCustomized() { ApplicationContext context = loadConfig(CustomConfig.class); AbstractSubscribableChannel channel = context.getBean( "brokerChannel", AbstractSubscribableChannel.class); assertEquals(4, channel.getInterceptors().size()); ThreadPoolTaskExecutor taskExecutor = context.getBean( "brokerChannelExecutor", ThreadPoolTaskExecutor.class); assertEquals(31, taskExecutor.getCorePoolSize()); assertEquals(32, taskExecutor.getMaxPoolSize()); assertEquals(33, taskExecutor.getKeepAliveSeconds()); }
Example #5
Source File: MessageBrokerConfigurationTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void clientOutboundChannelCustomized() { ApplicationContext context = loadConfig(CustomConfig.class); AbstractSubscribableChannel channel = context.getBean( "clientOutboundChannel", AbstractSubscribableChannel.class); assertEquals(4, channel.getInterceptors().size()); ThreadPoolTaskExecutor taskExecutor = context.getBean( "clientOutboundChannelExecutor", ThreadPoolTaskExecutor.class); assertEquals(21, taskExecutor.getCorePoolSize()); assertEquals(22, taskExecutor.getMaxPoolSize()); assertEquals(23, taskExecutor.getKeepAliveSeconds()); SimpleBrokerMessageHandler broker = context.getBean("simpleBrokerMessageHandler", SimpleBrokerMessageHandler.class); assertTrue(broker.isPreservePublishOrder()); }
Example #6
Source File: MessageBrokerConfigurationTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void brokerChannelCustomized() { AbstractSubscribableChannel channel = this.customContext.getBean( "brokerChannel", AbstractSubscribableChannel.class); assertEquals(4, channel.getInterceptors().size()); ThreadPoolTaskExecutor taskExecutor = this.customContext.getBean( "brokerChannelExecutor", ThreadPoolTaskExecutor.class); assertEquals(31, taskExecutor.getCorePoolSize()); assertEquals(32, taskExecutor.getMaxPoolSize()); assertEquals(33, taskExecutor.getKeepAliveSeconds()); }
Example #7
Source File: WebSocketMessageBrokerConfigurationSupportTests.java From java-technology-stack with MIT License | 5 votes |
@Override @Bean public AbstractSubscribableChannel clientInboundChannel() { TestChannel channel = new TestChannel(); channel.setInterceptors(super.clientInboundChannel().getInterceptors()); return channel; }
Example #8
Source File: AbstractMessageBrokerConfiguration.java From java-technology-stack with MIT License | 5 votes |
@Bean public AbstractSubscribableChannel clientInboundChannel() { ExecutorSubscribableChannel channel = new ExecutorSubscribableChannel(clientInboundChannelExecutor()); channel.setLogger(SimpLogging.forLog(channel.getLogger())); ChannelRegistration reg = getClientInboundChannelRegistration(); if (reg.hasInterceptors()) { channel.setInterceptors(reg.getInterceptors()); } return channel; }
Example #9
Source File: AbstractMessageBrokerConfiguration.java From java-technology-stack with MIT License | 5 votes |
@Bean public AbstractSubscribableChannel clientOutboundChannel() { ExecutorSubscribableChannel channel = new ExecutorSubscribableChannel(clientOutboundChannelExecutor()); channel.setLogger(SimpLogging.forLog(channel.getLogger())); ChannelRegistration reg = getClientOutboundChannelRegistration(); if (reg.hasInterceptors()) { channel.setInterceptors(reg.getInterceptors()); } return channel; }
Example #10
Source File: AbstractMessageBrokerConfiguration.java From java-technology-stack with MIT License | 5 votes |
@Bean public AbstractSubscribableChannel brokerChannel() { ChannelRegistration reg = getBrokerRegistry().getBrokerChannelRegistration(); ExecutorSubscribableChannel channel = (reg.hasTaskExecutor() ? new ExecutorSubscribableChannel(brokerChannelExecutor()) : new ExecutorSubscribableChannel()); reg.interceptors(new ImmutableMessageChannelInterceptor()); channel.setLogger(SimpLogging.forLog(channel.getLogger())); channel.setInterceptors(reg.getInterceptors()); return channel; }
Example #11
Source File: MessageBrokerConfigurationTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void clientInboundChannelCustomized() { ApplicationContext context = loadConfig(CustomConfig.class); AbstractSubscribableChannel channel = context.getBean( "clientInboundChannel", AbstractSubscribableChannel.class); assertEquals(3, channel.getInterceptors().size()); CustomThreadPoolTaskExecutor taskExecutor = context.getBean( "clientInboundChannelExecutor", CustomThreadPoolTaskExecutor.class); assertEquals(11, taskExecutor.getCorePoolSize()); assertEquals(12, taskExecutor.getMaxPoolSize()); assertEquals(13, taskExecutor.getKeepAliveSeconds()); }
Example #12
Source File: MessageBrokerBeanDefinitionParserTests.java From spring-analysis-note with MIT License | 5 votes |
private void testChannel( String channelName, List<Class<? extends MessageHandler>> subscriberTypes, int interceptorCount) { AbstractSubscribableChannel channel = this.appContext.getBean(channelName, AbstractSubscribableChannel.class); for (Class<? extends MessageHandler> subscriberType : subscriberTypes) { MessageHandler subscriber = this.appContext.getBean(subscriberType); assertNotNull("No subscription for " + subscriberType, subscriber); assertTrue(channel.hasSubscription(subscriber)); } List<ChannelInterceptor> interceptors = channel.getInterceptors(); assertEquals(interceptorCount, interceptors.size()); assertEquals(ImmutableMessageChannelInterceptor.class, interceptors.get(interceptors.size()-1).getClass()); }
Example #13
Source File: MessageBrokerConfigurationTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void clientOutboundChannelCustomized() { AbstractSubscribableChannel channel = this.customContext.getBean( "clientOutboundChannel", AbstractSubscribableChannel.class); assertEquals(3, channel.getInterceptors().size()); ThreadPoolTaskExecutor taskExecutor = this.customContext.getBean( "clientOutboundChannelExecutor", ThreadPoolTaskExecutor.class); assertEquals(21, taskExecutor.getCorePoolSize()); assertEquals(22, taskExecutor.getMaxPoolSize()); assertEquals(23, taskExecutor.getKeepAliveSeconds()); }
Example #14
Source File: MessageBrokerConfigurationTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void clientInboundChannelCustomized() { AbstractSubscribableChannel channel = this.customContext.getBean( "clientInboundChannel", AbstractSubscribableChannel.class); assertEquals(3, channel.getInterceptors().size()); CustomThreadPoolTaskExecutor taskExecutor = this.customContext.getBean( "clientInboundChannelExecutor", CustomThreadPoolTaskExecutor.class); assertEquals(11, taskExecutor.getCorePoolSize()); assertEquals(12, taskExecutor.getMaxPoolSize()); assertEquals(13, taskExecutor.getKeepAliveSeconds()); }
Example #15
Source File: AbstractMessageBrokerConfiguration.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Bean public AbstractSubscribableChannel brokerChannel() { ChannelRegistration reg = getBrokerRegistry().getBrokerChannelRegistration(); ExecutorSubscribableChannel channel = reg.hasTaskExecutor() ? new ExecutorSubscribableChannel(brokerChannelExecutor()) : new ExecutorSubscribableChannel(); reg.setInterceptors(new ImmutableMessageChannelInterceptor()); channel.setInterceptors(reg.getInterceptors()); return channel; }
Example #16
Source File: AbstractMessageBrokerConfiguration.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Bean public AbstractSubscribableChannel clientOutboundChannel() { ExecutorSubscribableChannel channel = new ExecutorSubscribableChannel(clientOutboundChannelExecutor()); ChannelRegistration reg = getClientOutboundChannelRegistration(); channel.setInterceptors(reg.getInterceptors()); return channel; }
Example #17
Source File: AbstractMessageBrokerConfiguration.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Bean public AbstractSubscribableChannel clientInboundChannel() { ExecutorSubscribableChannel channel = new ExecutorSubscribableChannel(clientInboundChannelExecutor()); ChannelRegistration reg = getClientInboundChannelRegistration(); channel.setInterceptors(reg.getInterceptors()); return channel; }
Example #18
Source File: WebSocketMessageBrokerConfigurationSupportTests.java From java-technology-stack with MIT License | 5 votes |
@Override @Bean public AbstractSubscribableChannel clientOutboundChannel() { TestChannel channel = new TestChannel(); channel.setInterceptors(super.clientOutboundChannel().getInterceptors()); return channel; }
Example #19
Source File: WebSocketMessageBrokerConfigurationSupportTests.java From spring-analysis-note with MIT License | 5 votes |
@Override @Bean public AbstractSubscribableChannel clientOutboundChannel() { TestChannel channel = new TestChannel(); channel.setInterceptors(super.clientOutboundChannel().getInterceptors()); return channel; }
Example #20
Source File: WebSocketMessageBrokerConfigurationSupportTests.java From spring-analysis-note with MIT License | 5 votes |
@Override @Bean public AbstractSubscribableChannel clientInboundChannel() { TestChannel channel = new TestChannel(); channel.setInterceptors(super.clientInboundChannel().getInterceptors()); return channel; }
Example #21
Source File: WebSocketMessageBrokerConfigurationSupportTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override @Bean public AbstractSubscribableChannel clientInboundChannel() { TestChannel channel = new TestChannel(); channel.setInterceptors(super.clientInboundChannel().getInterceptors()); return channel; }
Example #22
Source File: WebSocketMessageBrokerConfigurationSupportTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override @Bean public AbstractSubscribableChannel clientOutboundChannel() { TestChannel channel = new TestChannel(); channel.setInterceptors(super.clientOutboundChannel().getInterceptors()); return channel; }
Example #23
Source File: MessageBrokerBeanDefinitionParserTests.java From java-technology-stack with MIT License | 5 votes |
private void testChannel( String channelName, List<Class<? extends MessageHandler>> subscriberTypes, int interceptorCount) { AbstractSubscribableChannel channel = this.appContext.getBean(channelName, AbstractSubscribableChannel.class); for (Class<? extends MessageHandler> subscriberType : subscriberTypes) { MessageHandler subscriber = this.appContext.getBean(subscriberType); assertNotNull("No subscription for " + subscriberType, subscriber); assertTrue(channel.hasSubscription(subscriber)); } List<ChannelInterceptor> interceptors = channel.getInterceptors(); assertEquals(interceptorCount, interceptors.size()); assertEquals(ImmutableMessageChannelInterceptor.class, interceptors.get(interceptors.size()-1).getClass()); }
Example #24
Source File: MessageBrokerBeanDefinitionParserTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
private void testChannel(String channelName, List<Class<? extends MessageHandler>> subscriberTypes, int interceptorCount) { AbstractSubscribableChannel channel = this.appContext.getBean(channelName, AbstractSubscribableChannel.class); for (Class<? extends MessageHandler> subscriberType : subscriberTypes) { MessageHandler subscriber = this.appContext.getBean(subscriberType); assertNotNull("No subsription for " + subscriberType, subscriber); assertTrue(channel.hasSubscription(subscriber)); } List<ChannelInterceptor> interceptors = channel.getInterceptors(); assertEquals(interceptorCount, interceptors.size()); assertEquals(ImmutableMessageChannelInterceptor.class, interceptors.get(interceptors.size()-1).getClass()); }
Example #25
Source File: AbstractMessageBrokerConfiguration.java From spring-analysis-note with MIT License | 5 votes |
@Bean public AbstractSubscribableChannel clientInboundChannel() { ExecutorSubscribableChannel channel = new ExecutorSubscribableChannel(clientInboundChannelExecutor()); channel.setLogger(SimpLogging.forLog(channel.getLogger())); ChannelRegistration reg = getClientInboundChannelRegistration(); if (reg.hasInterceptors()) { channel.setInterceptors(reg.getInterceptors()); } return channel; }
Example #26
Source File: MessageBrokerConfigurationTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void clientInboundChannelCustomized() { ApplicationContext context = loadConfig(CustomConfig.class); AbstractSubscribableChannel channel = context.getBean( "clientInboundChannel", AbstractSubscribableChannel.class); assertEquals(3, channel.getInterceptors().size()); CustomThreadPoolTaskExecutor taskExecutor = context.getBean( "clientInboundChannelExecutor", CustomThreadPoolTaskExecutor.class); assertEquals(11, taskExecutor.getCorePoolSize()); assertEquals(12, taskExecutor.getMaxPoolSize()); assertEquals(13, taskExecutor.getKeepAliveSeconds()); }
Example #27
Source File: AbstractMessageBrokerConfiguration.java From spring-analysis-note with MIT License | 5 votes |
@Bean public AbstractSubscribableChannel brokerChannel() { ChannelRegistration reg = getBrokerRegistry().getBrokerChannelRegistration(); ExecutorSubscribableChannel channel = (reg.hasTaskExecutor() ? new ExecutorSubscribableChannel(brokerChannelExecutor()) : new ExecutorSubscribableChannel()); reg.interceptors(new ImmutableMessageChannelInterceptor()); channel.setLogger(SimpLogging.forLog(channel.getLogger())); channel.setInterceptors(reg.getInterceptors()); return channel; }
Example #28
Source File: AbstractMessageBrokerConfiguration.java From spring-analysis-note with MIT License | 5 votes |
@Bean public AbstractSubscribableChannel clientOutboundChannel() { ExecutorSubscribableChannel channel = new ExecutorSubscribableChannel(clientOutboundChannelExecutor()); channel.setLogger(SimpLogging.forLog(channel.getLogger())); ChannelRegistration reg = getClientOutboundChannelRegistration(); if (reg.hasInterceptors()) { channel.setInterceptors(reg.getInterceptors()); } return channel; }
Example #29
Source File: StompWebSocketIntegrationTests.java From java-technology-stack with MIT License | 4 votes |
@Override @Bean public AbstractSubscribableChannel clientOutboundChannel() { return new ExecutorSubscribableChannel(); // synchronous }
Example #30
Source File: StompWebSocketIntegrationTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override @Bean public AbstractSubscribableChannel clientOutboundChannel() { return new ExecutorSubscribableChannel(); // synchronous }