خرید بک لینک

Vote count: 0

I am trying to start a simple websocket server in a spring integration application.

Here is my "integartion.xml" :

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:int="http://www.springframework.org/schema/integration"
    xmlns:file="http://www.springframework.org/schema/integration/file"
    xmlns:feed="http://www.springframework.org/schema/integration/feed"
        xmlns:int-ip="http://www.springframework.org/schema/integration/ip"
        xmlns:ws="http://www.springframework.org/schema/integration/websocket"
    xsi:schemaLocation="http://www.springframework.org/schema/integration/feed http://www.springframework.org/schema/integration/feed/spring-integration-feed.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/integration/file http://www.springframework.org/schema/integration/file/spring-integration-file.xsd
        http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
                http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/integration/ip/spring-integration-ip.xsd
                http://www.springframework.org/schema/integration/websocket http://www.springframework.org/schema/integration/websocket/spring-integration-websocket.xsd">

    <int-ip:udp-inbound-chael-adapter id="udpReceiver"
        chael="udpOutChael"
        port="11111"
        receive-buffer-size="500"
        multicast="true"
        multicast-address="225.6.7.8"/>
    <int:object-to-string-transformer input-chael="udpOutChael" output-chael="stringified"/>
    <bean id="nmeaParser" class="transformers.NMEAParser"/>   
    <int:transformer input-chael="stringified" ref="nmeaParser" output-chael="parsedData"/>   
    <int:chael id="jsondata"/>
    <int:object-to-json-transformer input-chael="parsedData" output-chael="jsondata"/>
    <ws:server-container id="server" path="/position"/>        
    <ws:outbound-chael-adapter container="server" chael="jsondata"/>
</beans>

As you can see, I create an UDP inbound chael. This chaels works like a charm. I am able to see that data are sucessfully passed to my "NMEAParser" bean.

I think that my Websocket server doesn't work because :

I can't coect to it with wscat... When I try to do :

wscat -c ws://127.0.0.1/position

I receive a "CONNECTION REFUSED", the same message I receive when nothing is launched.

In the Spring log's I can read this :

Starting beans in phase 0    
Adding {object-to-string-transformer} as a subscriber to the 'udpOutChael' chael    
Chael 'application:8080.udpOutChael' has 1 subscriber(s).   
started org.springframework.integration.config.ConsumerEndpointFactoryBean#0    
Adding {transformer} as a subscriber to the 'stringified' chael    
Chael 'application:8080.stringified' has 1 subscriber(s).    
started org.springframework.integration.config.ConsumerEndpointFactoryBean#1    
Adding {object-to-json-transformer} as a subscriber to the 'parsedData' chael    
Chael 'application:8080.parsedData' has 1 subscriber(s).    
started org.springframework.integration.config.ConsumerEndpointFactoryBean#2    
Adding {websocket:outbound-chael-adapter} as a subscriber to the 'jsondata' chael    
Chael 'application:8080.jsondata' has 1 subscriber(s).    
started org.springframework.integration.config.ConsumerEndpointFactoryBean#3    
Adding {logging-chael-adapter:_org.springframework.integration.errorLogger} as a subscriber to the 'errorChael' chael    
Chael 'application:8080.errorChael' has 1 subscriber(s).    
started _org.springframework.integration.errorLogger    
Starting beans in phase 1073741823    
started udpReceiver    
Started Application in 0.792 seconds (JVM ruing for 1.121)

We can see here that all my beans are launched, except the bean "server" which is my server container. There is no trace of this bean in this log message.

To write my application I read carrefully this sampe and this doc.

What am I doing wrong, or what I forgot ?

asked 1 min ago

- - , .

برچسب: نویسنده: استخدام کار تاريخ: يکشنبه 25 بهمن 1394 ساعت: 22:35

صفحه بندی