Package org.springframework.integration.core

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


        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

  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

  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

TOP

Related Classes of org.springframework.integration.core.SubscribableChannel

Copyright © 2018 www.massapicom. 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.