0

I have been successfully using Camel MINA for listening on a single port. I would now like to modify the configuration so that I can listen on several ports. I am not exactly sure how to do this. I have included a snip of the xml config and the associated class below:

<!-- 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" />

application.properties

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

Component class

@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();
    }
}

1 Answer 1

1

You need to create a hl7listener and Camel route per port you want to listen.

1
  • I was thinking that you could only load one set of properties, but of course the properties can have different names such as endpoint1.port and endpoint2.port.
    – skyman
    Jul 29, 2014 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.