Examples of SubscribableChannel


Examples of org.springframework.integration.core.SubscribableChannel

        return messageChannels;
    }

    private SubscribableChannel findOrCreateChannel(String channelName, ListenerId listenerId) {
        SubscribableChannel _channel;
        try {
            _channel = ctx.getBean(channelName, SubscribableChannel.class);
            return _channel;
        } catch (BeansException be) {
            log.debug("no overriding/existing channel found " + be.getMessage());
View Full Code Here

Examples of org.springframework.integration.core.SubscribableChannel

        beanFactory.registerBeanDefinition(beanId, beanDefinition);
        ServiceActivatingHandler _serviceActivatingHandler = ctx.getBean(beanId, ServiceActivatingHandler.class);

        MessageChannel bridgeChannel = null;
        SubscribableChannel channel = null;
        String channelName =
                (
                        listener.getNamespace() != null &&
                                !listener.getNamespace().equalsIgnoreCase(APP_NAMESPACE) ? listener.getNamespace() + "://" : ""
                )
                        + listener.getTopic();


        try {
            bridgeChannel = ctx.getBean(channelName, MessageChannel.class);

            if (!GrailsPublishSubscribeChannel.class.isAssignableFrom(bridgeChannel.getClass())) {
                channel = findOrCreateChannel(channelName + "-local", listener);

                if (autoBridge  && bridgeChannel.getClass().isAssignableFrom(SubscribableChannel.class)) {
                    BridgeHandler bridgeHandler = new BridgeHandler(channelName);
                    bridgeHandler.setOutputChannel(channel);
                    ((SubscribableChannel) bridgeChannel).subscribe(bridgeHandler);
                }

            } else {
                channel = (GrailsPublishSubscribeChannel) bridgeChannel;
            }

        } catch (BeansException be) {
            log.debug("no overriding/existing channel found " + be.getMessage());

            channel = findOrCreateChannel(channelName, listener);
        }

        channel.subscribe(_serviceActivatingHandler);

        if (bridgeChannel != channel) {
            synchronized (grailsListenerChannels) {
                grailsListenerChannels.put(listener, bridgeChannel == null ? channel : bridgeChannel);
            }
View Full Code Here

Examples of org.springframework.integration.core.SubscribableChannel

  public static void main(String args[]) {
    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(
        "SplunkOutboundChannelAdapterTcpSample-context.xml", SplunkOutboundChannelAdapterTcpSample.class);
    ctx.start();

    SubscribableChannel channel = ctx.getBean("outputToSplunk", SubscribableChannel.class);

    SplunkData data = new SplunkData("spring", "spring:example");
    data.setCommonDesc("description");

    Message<SplunkData> msg = MessageBuilder.withPayload(data).build();
    channel.send(msg);


  }
View Full Code Here

Examples of org.springframework.integration.core.SubscribableChannel

  public static void main(String args[]) {
    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(
        "SplunkOutboundChannelAdapterStreamSample-context.xml", SplunkOutboundChannelAdapterStreamSample.class);
    ctx.start();

    SubscribableChannel channel = ctx.getBean("outputToSplunk", SubscribableChannel.class);

    SplunkData data = new SplunkData("spring", "spring:example");
    data.setCommonDesc("description");

    Message<SplunkData> msg = MessageBuilder.withPayload(data).build();
    channel.send(msg);


  }
View Full Code Here

Examples of org.springframework.messaging.SubscribableChannel

  public void testHappyPath() {

    // add a listener to this channel, otherwise there is not one defined
    // the reason we use a listener here is so we can assert truths on the
    // message and/or payload
    SubscribableChannel channel = (SubscribableChannel) incomingServerChannel;
    channel.subscribe(new AbstractReplyProducingMessageHandler() {

      @Override
      protected Object handleRequestMessage(Message<?> requestMessage) {
        byte[] payload = (byte[]) requestMessage.getPayload();
View Full Code Here

Examples of org.springframework.messaging.SubscribableChannel

  public void testHappyPath() {

    // add a listener to this channel, otherwise there is not one defined
    // the reason we use a listener here is so we can assert truths on the
    // message and/or payload
    SubscribableChannel channel = (SubscribableChannel) incomingServerChannel;
    channel.subscribe(new AbstractReplyProducingMessageHandler(){

      @Override
      protected Object handleRequestMessage(Message<?> requestMessage) {
        CustomOrder payload = (CustomOrder) requestMessage.getPayload();
View Full Code Here

Examples of org.springframework.messaging.SubscribableChannel

public class SockJsWebSocketHandlerTests {


  @Test
  public void getSubProtocols() throws Exception {
    SubscribableChannel channel = mock(SubscribableChannel.class);
    SubProtocolWebSocketHandler handler = new SubProtocolWebSocketHandler(channel, channel);
    StompSubProtocolHandler stompHandler = new StompSubProtocolHandler();
    handler.addProtocolHandler(stompHandler);

    TaskScheduler scheduler = mock(TaskScheduler.class);
View Full Code Here

Examples of org.springframework.messaging.SubscribableChannel

  private UserSessionRegistry userSessionRegistry;


  @Before
  public void setup() {
    SubscribableChannel inChannel = Mockito.mock(SubscribableChannel.class);
    SubscribableChannel outChannel = Mockito.mock(SubscribableChannel.class);
    this.webSocketHandler = new SubProtocolWebSocketHandler(inChannel, outChannel);
    this.userSessionRegistry = new DefaultUserSessionRegistry();
    this.endpointRegistry = new WebMvcStompEndpointRegistry(this.webSocketHandler,
        new WebSocketTransportRegistration(), this.userSessionRegistry, Mockito.mock(TaskScheduler.class));
  }
View Full Code Here

Examples of org.springframework.messaging.SubscribableChannel


  @Test
  public void test() {

    SubscribableChannel clientInboundChannel = new StubMessageChannel();
    MessageChannel clientOutboundChannel = new StubMessageChannel();
    SubscribableChannel brokerChannel = new StubMessageChannel();

    String[] destinationPrefixes = new String[] { "/foo", "/bar" };

    StompBrokerRelayRegistration registration = new StompBrokerRelayRegistration(
        clientInboundChannel, clientOutboundChannel, destinationPrefixes);
View Full Code Here

Examples of org.springframework.messaging.SubscribableChannel


  @Test
  public void sendAndReceive() {

    SubscribableChannel channel = new ExecutorSubscribableChannel(this.executor);
    channel.subscribe(new MessageHandler() {
      @Override
      public void handleMessage(Message<?> message) throws MessagingException {
        MessageChannel replyChannel = (MessageChannel) message.getHeaders().getReplyChannel();
        replyChannel.send(new GenericMessage<String>("response"));
      }
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.