0

私は Camel MINA を使用して、単一のポートでリッスンすることに成功しています。複数のポートでリッスンできるように、構成を変更したいと思います。これを行う方法が正確にはわかりません。以下に、xml 構成と関連するクラスの抜粋を含めました。

<!-- enable Spring @Component scan -->
<context:component-scan base-package="foo.bar.hl7" />

<bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent">
    <property name="ignoreMissingLocation" value="true" />
    <property name="locations">
            <list>
                <value>file:${catalina.home}/application.properties</value>
            </list>
    </property>
</bean>

<bean id="myhl7codec" class="org.apache.camel.component.hl7.HL7MLLPCodec">
    <property name="charset" value="iso-8859-1"/>
    <property name="validate" value="false"/>
</bean>

<camelContext xmlns="http://camel.apache.org/schema/spring" id="camelContext">
    <contextScan />
    <!-- You need to configure your socket in the endpoint.properties file -->
    <camel:endpoint id="hl7listener" uri="mina2:tcp://{{endpoint.server}}:{{endpoint.port}}?sync=true&amp;codec=#myhl7codec" />
</camelContext>

<context:annotation-config />

<bean class="foo.bar.hl7.HL7ListenerConfiguration" />

アプリケーションのプロパティ

#### HL7 Endpoint Configuration
endpoint.server=192.168.1.219
endpoint.port=9001

コンポーネント クラス

@Configuration
public class HL7ListenerConfiguration {
    private static final Logger log = LoggerFactory.getLogger(HL7ListenerConfiguration.class);

    @Bean
    public RespondACK RespondACK() {
        return new RespondACK();
    }

    @Bean
    public ADTInboundRouteBuilder ADTInboundRouteBuilder() {
        log.debug("Building MLLP Route");
        return new ADTInboundRouteBuilder();
    }
}
4

1 に答える 1

1

リッスンするポートごとに hl7listener と Camel ルートを作成する必要があります。

于 2014-07-29T06:53:32.660 に答える