Java Spring集成IP UDP-入站/出站错误

Java Spring集成IP UDP-入站/出站错误,java,spring-mvc,spring-integration,Java,Spring Mvc,Spring Integration,我正在尝试在两个应用程序之间进行通信: <int:inbound-channel-adapter channel="quakeinfotrigger.channel" expression="''"> <int:poller fixed-delay="60000" /> </int:inbound-channel-adapter> <int:channel id="quakeinfotrigger.channel

我正在尝试在两个应用程序之间进行通信:

    <int:inbound-channel-adapter channel="quakeinfotrigger.channel" expression="''">
        <int:poller fixed-delay="60000" />
    </int:inbound-channel-adapter>

    <int:channel id="quakeinfotrigger.channel" />

    <int:inbound-channel-adapter channel="quakeinfotrigger.channel" expression="''">
        <int:poller fixed-delay="60000" />
    </int:inbound-channel-adapter>

    <int-ip:udp-inbound-channel-adapter id="metoo" port="11111" channel="quakeinfotrigger.channel"/>
在第一个应用程序中,我已经做了类似的事情,并且工作没有错误,它是否工作,我不知道

public class Main {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/new_tutorial.xml");
        applicationContext.registerShutdownHook();
    }
}
it的XML配置:

    <int:inbound-channel-adapter channel="quakeinfotrigger.channel" expression="''">
        <int:poller fixed-delay="60000" />
    </int:inbound-channel-adapter>

    <int:channel id="quakeinfo.channel">
        <int:queue capacity="10"/>
    </int:channel>

    <int:channel id="quakeinfotrigger.channel" />

    <int:inbound-channel-adapter channel="quakeinfotrigger.channel" expression="''">
        <int:poller fixed-delay="60000" />
    </int:inbound-channel-adapter>

    <int-ip:udp-outbound-channel-adapter id="metoo" channel="quakeinfotrigger.channel" port="11111" host="localhost"/>

    <int:logging-channel-adapter id="messageLogger" log-full-message="true" channel="quakeinfo.channel" level="ERROR">
        <int:poller fixed-delay="5000" />
    </int:logging-channel-adapter>
在第二个应用程序的xml代码中:

    <int:inbound-channel-adapter channel="quakeinfotrigger.channel" expression="''">
        <int:poller fixed-delay="60000" />
    </int:inbound-channel-adapter>

    <int:channel id="quakeinfotrigger.channel" />

    <int:inbound-channel-adapter channel="quakeinfotrigger.channel" expression="''">
        <int:poller fixed-delay="60000" />
    </int:inbound-channel-adapter>

    <int-ip:udp-inbound-channel-adapter id="metoo" port="11111" channel="quakeinfotrigger.channel"/>
我想将消息从onr应用程序传递到其他应用程序,但我对spring集成还不熟悉,所以我不知道该怎么做?
有什么帮助吗?

您没有从
QuakeInfo触发器中消费任何东西
-您有两个轮询的入站适配器和UDP入站适配器,它们都会生成消息并将它们发送到该通道,但您需要一些东西来实际处理消息。

尝试以下方法。 你的接收器应用程序:

<int:channel id="quakeinfotrigger.channel">
        <int:queue />
    </int:channel>

    <int-ip:udp-inbound-channel-adapter id="metoo" port="11111" channel="quakeinfotrigger.channel"/>

    <int:service-activator input-channel="quakeinfotrigger.channel"
        output-channel="logger"
        ref="echoService" 
        method="test">
        <int:poller fixed-rate="1000" />
    </int:service-activator>

    <bean id="echoService"
        class="com.foo.bar.EchoService" />

    <int:logging-channel-adapter id="logger" logger-name="com.foo.bar"/>


public class EchoService {
    public String test(String input) {
        return input + ":echo";
    }
}

public class InboundESB {
    public static void main(String[] args) {       
        ApplicationContext context = new ClassPathXmlApplicationContext("/getinbound.xml");
context.registerShutdownHook();
    }
}

Sender
接口是Spring集成API的入口点(网关)。调用此网关上的一个方法后,消息将被放到通道上,并通过出站通道适配器发送。

我为发件人编写了类似于您的代码,但它显示了一个错误:
NoSuchMethodException
。哪个类的哪个方法会引发此错误?还有,它说哪种方法不存在?
<int:channel id="quakeinfotrigger.channel">
        <int:queue />
    </int:channel>

    <int-ip:udp-inbound-channel-adapter id="metoo" port="11111" channel="quakeinfotrigger.channel"/>

    <int:service-activator input-channel="quakeinfotrigger.channel"
        output-channel="logger"
        ref="echoService" 
        method="test">
        <int:poller fixed-rate="1000" />
    </int:service-activator>

    <bean id="echoService"
        class="com.foo.bar.EchoService" />

    <int:logging-channel-adapter id="logger" logger-name="com.foo.bar"/>


public class EchoService {
    public String test(String input) {
        return input + ":echo";
    }
}

public class InboundESB {
    public static void main(String[] args) {       
        ApplicationContext context = new ClassPathXmlApplicationContext("/getinbound.xml");
context.registerShutdownHook();
    }
}
<int:channel id="quakeinfotrigger.channel" />

    <int:gateway id="sender"
        service-interface="com.foo.bar.Sender"
        default-request-channel="quakeinfotrigger.channel" 
    />

    <int-ip:udp-outbound-channel-adapter id="metoo" channel="quakeinfotrigger.channel" port="11111" host="localhost"/>

public interface Sender {
    public void sendMessage(String message);
}

public class Main {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/new_tutorial.xml");
        applicationContext.registerShutdownHook();

        Sender sender = (Sender) context.getBean("sender");
        sender.sendMessage("123");
    }
}