[CONF] Apache Camel NMR
NMR Page edited by Freeman Fang Changes (1) ... | {{timeout}} | {{0}} | *Apache ServiceMix 4.4:* When this is set to a value greater than 0, the producer endpoint will timeout if it doesnt receive a response from the NMR within the given timeout period (in milliseconds). Configuring a timeout value will switch to using synchronous interactions with the NMR instead of the usual asynchronous messaging. | | {{throwExceptionOnFailure}} | true | *Apache ServiceMix 4.5.2:* When this is set to {{{*}false{*}}} then NMRs exceptions (like TimeoutException) will be consumed silently. | | {{interfaceName}} | null | *Apache ServiceMix 4.5.3:* When specify this as a {{{*}QName{*}}} then it could be considered when NMR looking for the target NMR endpoint during dispatch| | {{serviceName}} | null | *Apache ServiceMix 4.5.3:* When specify this as a {{{*}QName{*}}} then it could be considered when NMR looking for the target NMR endpoint during dispatch| {div} ... Full Content NMR Component The nmr component is an adapter to the Normalized Message Router (NMR) in ServiceMix, which is intended for use by Camel applications deployed directly into the OSGi container. You can exchange objects with NMR and not only XML like this is the case with the JBI specification. The interest of this component is that you can interconnect camel routes deployed in different OSGI bundles. By contrast, the JBI component is intended for use by Camel applications deployed into the ServiceMix JBI container. Installing in Apache Servicemix The NMR component is provided with Apache ServiceMix. It is not distributed with Camel. To install the NMR component in ServiceMix, enter the following command in the ServiceMix console window: features:install nmr camel-nmr Installing in plain Apache Karaf In plain Karaf the nmr component can also be installed using the servicemix artifacts: features:chooseurl camel version features:addurl mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/1.5.0/xml/features features:install camel-blueprint nmr camel-nmr install -s mvn:org.apache.servicemix.camel/org.apache.servicemix.camel.component/4.4.2 Configuration You also need to instantiate the NMR component. You can do this by editing your Spring configuration file, META-INF/spring/*.xml, and adding the following bean instance: beans xmlns:osgi="http://www.springframework.org/schema/osgi" ... ... bean id="nmr" class="org.apache.servicemix.camel.nmr.ServiceMixComponent" property name="nmr" osgi:reference interface="org.apache.servicemix.nmr.api.NMR" / /property /bean ... /beans NMR consumer and producer endpoints The following code: from("nmr:MyServiceEndpoint") Automatically exposes a new endpoint to the bus with endpoint name MyServiceEndpoint (see URI-format). When an NMR endpoint appears at the end of a route, for example: to("nmr:MyServiceEndpoint") The messages sent by this producer endpoint are sent to the already deployed NMR endpoint. URI format nmr:endpointName URI Options Option Default Value Description runAsSubject false Apache ServiceMix 4.4: When this is set to true on a consumer endpoint, the endpoint will be invoked on behalf of the Subject that is set on the Exchange (i.e. the call to Subject.getSubject(AccessControlContext) will return the Subject instance) synchronous false When this is set to true on a consumer endpoint, an incoming, synchronous NMR Exchange will be handled on the sender's thread instead of being handled on a new thread of the NMR endpoint's thread pool timeout 0 Apache ServiceMix 4.4: When this is set to a value greater than 0, the producer endpoint will timeout if it doesn't receive a response from the NMR within the given timeout period (in milliseconds). Configuring a timeout value will switch to using synchronous interactions with the NMR instead of the usual asynchronous messaging. throwExceptionOnFailure true Apache ServiceMix 4.5.2: When this is set to false then NMR's exceptions (like TimeoutException) will be consumed silently. interfaceName null Apache ServiceMix 4.5.3: When specify this as a QName then it could be considered when NMR looking for the target NMR endpoint during dispatch serviceName null Apache ServiceMix 4.5.3: When specify this as a QName then it could be considered when NMR looking for the target NMR endpoint during dispatch Examples Consumer from("nmr:MyServiceEndpoint") // consume nmr exchanges asynchronously from("nmr:MyServiceEndpoint?synchronous=true").to() // consume nmr exchanges synchronously and use the same thread as defined by NMR ThreadPool Producer
[CONF] Apache Camel NMR
NMR Page edited by Piotr Klimczak Changes (4) ... {code} h3. Installing in plain Apache Karaf In plain Karaf the nmr component can also be installed using the servicemix artifacts: ... {code} Automatically exposes a new endpoint to the bus with endpoint name {{MyServiceEndpoint}} (see [URI-format|#URI-format]). When an NMR endpoint appears at the end of a route, for example: ... {div:class=confluenceTableSmall} || Option || Default Value || Description || | {{runAsSubject}} | {{false}} | *Apache ServiceMix 4.4:* When this is set to *{{true}}* {{{*}true{*}}} on a consumer endpoint, the endpoint will be invoked on behalf of the {{Subject}} that is set on the {{Exchange}} (i.e. the call to {{Subject.getSubject(AccessControlContext)}} will return the {{Subject}} instance) | | {{synchronous}} | {{false}} | When this is set to *{{true}}* {{{*}true{*}}} on a consumer endpoint, an incoming, synchronous NMR Exchange will be handled on the senders thread instead of being handled on a new thread of the NMR endpoints thread pool | | {{timeout}} | {{0}} | *Apache ServiceMix 4.4:* When this is set to a value greater than 0, the producer endpoint will timeout if it doesnt receive a response from the NMR within the given timeout period (in milliseconds). Configuring a timeout value will switch to using synchronous interactions with the NMR instead of the usual asynchronous messaging. | | {{throwExceptionOnFailure}} | true | *Apache ServiceMix 4.5.2:* When this is set to {{{*}false{*}}} then NMRs exceptions (like TimeoutException) will be consumed silently. | {div} ... Full Content NMR Component The nmr component is an adapter to the Normalized Message Router (NMR) in ServiceMix, which is intended for use by Camel applications deployed directly into the OSGi container. You can exchange objects with NMR and not only XML like this is the case with the JBI specification. The interest of this component is that you can interconnect camel routes deployed in different OSGI bundles. By contrast, the JBI component is intended for use by Camel applications deployed into the ServiceMix JBI container. Installing in Apache Servicemix The NMR component is provided with Apache ServiceMix. It is not distributed with Camel. To install the NMR component in ServiceMix, enter the following command in the ServiceMix console window: features:install nmr camel-nmr Installing in plain Apache Karaf In plain Karaf the nmr component can also be installed using the servicemix artifacts: features:chooseurl camel version features:addurl mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/1.5.0/xml/features features:install camel-blueprint nmr camel-nmr install -s mvn:org.apache.servicemix.camel/org.apache.servicemix.camel.component/4.4.2 Configuration You also need to instantiate the NMR component. You can do this by editing your Spring configuration file, META-INF/spring/*.xml, and adding the following bean instance: beans xmlns:osgi="http://www.springframework.org/schema/osgi" ... ... bean id="nmr" class="org.apache.servicemix.camel.nmr.ServiceMixComponent" property name="nmr" osgi:reference interface="org.apache.servicemix.nmr.api.NMR" / /property /bean ... /beans NMR consumer and producer endpoints The following code: from("nmr:MyServiceEndpoint") Automatically exposes a new endpoint to the bus with endpoint name MyServiceEndpoint (see URI-format). When an NMR endpoint appears at the end of a route, for example: to("nmr:MyServiceEndpoint") The messages sent by this producer endpoint are sent to the already deployed NMR endpoint. URI format nmr:endpointName URI Options Option Default Value Description runAsSubject false Apache ServiceMix 4.4: When this is set to true on a consumer endpoint, the endpoint will be invoked on behalf of the Subject that is set on the Exchange (i.e. the call to Subject.getSubject(AccessControlContext) will return the Subject instance) synchronous false When this is set to true on a consumer endpoint, an incoming, synchronous NMR Exchange will be handled on the sender's thread instead of being handled on a new thread of the NMR endpoint's thread pool timeout 0 Apache ServiceMix 4.4: When this is set to a value greater than 0, the producer endpoint will timeout if it doesn't receive a response from the NMR within the given timeout period (in milliseconds). Configuring a timeout value will switch to using synchronous interactions with the NMR instead of the usual asynchronous messaging.
[CONF] Apache Camel NMR
NMR Page edited by Christian Schneider Comment: Description how to install camel-nmr in plain karaf Changes (4) ... By contrast, the [JBI] component is intended for use by Camel applications deployed into the ServiceMix JBI container. h3. Installing in Apache Servicemix The NMR component is provided with Apache ServiceMix. It is *not* distributed with Camel. To install the NMR component in ServiceMix, enter the following command in the ServiceMix console window: {code} features install nmr features:install nmr camel-nmr {code} h3. Installing in plain Apache Karaf In plain Karaf the nmr component can also be installed using the servicemix artifacts: {code} features:chooseurl camel version features:addurl mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/1.5.0/xml/features features:install camel-blueprint nmr camel-nmr install -s mvn:org.apache.servicemix.camel/org.apache.servicemix.camel.component/4.4.2 {code} h3. Configuration You also need to instantiate the NMR component. You can do this by editing your Spring configuration file, {{META-INF/spring/*.xml}}, and adding the following {{bean}} instance: ... Full Content NMR Component The nmr component is an adapter to the Normalized Message Router (NMR) in ServiceMix, which is intended for use by Camel applications deployed directly into the OSGi container. You can exchange objects with NMR and not only XML like this is the case with the JBI specification. The interest of this component is that you can interconnect camel routes deployed in different OSGI bundles. By contrast, the JBI component is intended for use by Camel applications deployed into the ServiceMix JBI container. Installing in Apache Servicemix The NMR component is provided with Apache ServiceMix. It is not distributed with Camel. To install the NMR component in ServiceMix, enter the following command in the ServiceMix console window: features:install nmr camel-nmr Installing in plain Apache Karaf In plain Karaf the nmr component can also be installed using the servicemix artifacts: features:chooseurl camel version features:addurl mvn:org.apache.servicemix.nmr/apache-servicemix-nmr/1.5.0/xml/features features:install camel-blueprint nmr camel-nmr install -s mvn:org.apache.servicemix.camel/org.apache.servicemix.camel.component/4.4.2 Configuration You also need to instantiate the NMR component. You can do this by editing your Spring configuration file, META-INF/spring/*.xml, and adding the following bean instance: beans xmlns:osgi="http://www.springframework.org/schema/osgi" ... ... bean id="nmr" class="org.apache.servicemix.camel.nmr.ServiceMixComponent" property name="nmr" osgi:reference interface="org.apache.servicemix.nmr.api.NMR" / /property /bean ... /beans NMR consumer and producer endpoints The following code: from("nmr:MyServiceEndpoint") Automatically exposes a new endpoint to the bus with endpoint name MyServiceEndpoint (see URIformat). When an NMR endpoint appears at the end of a route, for example: to("nmr:MyServiceEndpoint") The messages sent by this producer endpoint are sent to the already deployed NMR endpoint. URI format nmr:endpointName URI Options Option Default Value Description runAsSubject false Apache ServiceMix 4.4: When this is set to true on a consumer endpoint, the endpoint will be invoked on behalf of the Subject that is set on the Exchange (i.e. the call to Subject.getSubject(AccessControlContext) will return the Subject instance) synchronous false When this is set to true on a consumer endpoint, an incoming, synchronous NMR Exchange will be handled on the sender's thread instead of being handled on a new thread of the NMR endpoint's thread pool timeout 0 Apache ServiceMix 4.4: When this is set to a value greater than 0, the producer endpoint will timeout if it doesn't receive a response from the NMR within the given timeout period (in milliseconds). Configuring a timeout value will switch to using synchronous interactions with the NMR instead of the usual asynchronous messaging. Examples Consumer from("nmr:MyServiceEndpoint") // consume nmr exchanges asynchronously from("nmr:MyServiceEndpoint?synchronous=true").to() // consume nmr exchanges synchronously and use the same thread as defined by NMR ThreadPool Producer from()...to("nmr:MyServiceEndpoint") // produce nmr exchanges asynchronously from()...to("nmr:MyServiceEndpoint?timeout=1") // produce nmr exchanges synchronously and wait till 10s to receive response Using Stream bodies If you are
[CONF] Apache Camel NMR
NMR Page edited by Christian Mueller Comment: Removed the deprecated Camel 1.x documentations Changes (2) ... {code} From *Camel 1.5* onwards, the The stream caching is default enabled, so it is not necessary to set the {{streamCaching()}} option. In *Camel 2.0* we We store big input streams (by default, over 64K) in a {{temp}} file using {{CachedOutputStream}}. When you close the input stream, the temp file will be deleted. h4. Testing ... Full Content NMR Component The nmr component is an adapter to the Normalized Message Router (NMR) in ServiceMix, which is intended for use by Camel applications deployed directly into the OSGi container. You can exchange objects with NMR and not only XML like this is the case with the JBI specification. The interest of this component is that you can interconnect camel routes deployed in different OSGI bundles. By contrast, the JBI component is intended for use by Camel applications deployed into the ServiceMix JBI container. Installing The NMR component is provided with Apache ServiceMix. It is not distributed with Camel. To install the NMR component in ServiceMix, enter the following command in the ServiceMix console window: features install nmr You also need to instantiate the NMR component. You can do this by editing your Spring configuration file, META-INF/spring/*.xml, and adding the following bean instance: beans xmlns:osgi="http://www.springframework.org/schema/osgi" ... ... bean id="nmr" class="org.apache.servicemix.camel.nmr.ServiceMixComponent" property name="nmr" osgi:reference interface="org.apache.servicemix.nmr.api.NMR" / /property /bean ... /beans NMR consumer and producer endpoints The following code: from("nmr:MyServiceEndpoint") Automatically exposes a new endpoint to the bus with endpoint name MyServiceEndpoint (see URIformat). When an NMR endpoint appears at the end of a route, for example: to("nmr:MyServiceEndpoint") The messages sent by this producer endpoint are sent to the already deployed NMR endpoint. URI format nmr:endpointName URI Options Option Default Value Description runAsSubject false Apache ServiceMix 4.4: When this is set to true on a consumer endpoint, the endpoint will be invoked on behalf of the Subject that is set on the Exchange (i.e. the call to Subject.getSubject(AccessControlContext) will return the Subject instance) synchronous false When this is set to true on a consumer endpoint, an incoming, synchronous NMR Exchange will be handled on the sender's thread instead of being handled on a new thread of the NMR endpoint's thread pool timeout 0 Apache ServiceMix 4.4: When this is set to a value greater than 0, the producer endpoint will timeout if it doesn't receive a response from the NMR within the given timeout period (in milliseconds). Configuring a timeout value will switch to using synchronous interactions with the NMR instead of the usual asynchronous messaging. Examples Consumer from("nmr:MyServiceEndpoint") // consume nmr exchanges asynchronously from("nmr:MyServiceEndpoint?synchronous=true").to() // consume nmr exchanges synchronously and use the same thread as defined by NMR ThreadPool Producer from()...to("nmr:MyServiceEndpoint") // produce nmr exchanges asynchronously from()...to("nmr:MyServiceEndpoint?timeout=1") // produce nmr exchanges synchronously and wait till 10s to receive response Using Stream bodies If you are using a stream type as the message body, you should be aware that a stream is only capable of being read once. So if you enable DEBUG logging, the body is usually logged and thus read. To deal with this, Camel has a streamCaching option that can cache the stream, enabling you to read it multiple times. from("nmr:MyEndpoint").streamCaching().to("xslt:transform.xsl", "bean:doSomething"); The stream caching is default enabled, so it is not necessary to set the streamCaching() option. We store big input streams (by default, over 64K) in a temp file using CachedOutputStream. When you close the input stream, the temp file will be deleted. Testing NMR camel routes can be tested using the camel unit test approach even if they will be deployed next in different bundles on an OSGI runtime. With this aim in view, you will extend the ServiceMixNMR Mock class org.apache.servicemix.camel.nmr.AbstractComponentTest which will create a NMR bus, register the Camel NMR Component and the endpoints defined into the Camel routes. public class ExchangeUsingNMRTest extends AbstractComponentTest { @Test public void testProcessing() throws InterruptedException
[CONF] Apache Camel NMR
NMR Page edited by charles Moulliard Comment: Add more examples + unit test Changes (8) h2. NMR Component The *nmr* component is an adapter to the Normalized Message Router (NMR) in [ServiceMix|http://servicemix.apache.org/home.html], which is intended for use by Camel applications deployed directly into the OSGi container. By contrast, the [JBI] component is intended for use by Camel applications deployed into the ServiceMix JBI container. The *nmr* component is an adapter to the Normalized Message Router (NMR) in [ServiceMix|http://servicemix.apache.org/home.html], which is intended for use by Camel applications deployed directly into the OSGi container. You can exchange objects with NMR and not only XML like this is the case with the JBI specification. The interest of this component is that you can interconnect camel routes deployed in different OSGI bundles. By contrast, the [JBI] component is intended for use by Camel applications deployed into the ServiceMix JBI container. h3. Installing ... h4. Examples Consumer {code} from(nmr:MyServiceEndpoint) from(nmr:MyServiceEndpoint?synchronous=true).to(nmr:AnotherEndpoint) from(nmr:MyServiceEndpoint) // consume nmr exchanges asynchronously from(nmr:MyServiceEndpoint?synchronous=true).to() // consume nmr exchanges synchronously and use the same thread as defined by NMR ThreadPool {code} Producer {code} from()...to(nmr:MyServiceEndpoint) // produce nmr exchanges asynchronously from()...to(nmr:MyServiceEndpoint?timeout=1) // produce nmr exchanges synchronously and wait till 10s to receive response {code} h3. Using Stream bodies If you are using a stream type as the message body, you should be aware that a stream is only capable of being read once. So if you enable {{DEBUG}} logging, the body is usually logged and thus read. To deal with this, Camel has a {{streamCaching}} option that can cache the stream, enabling you to read it multiple times. ... In *Camel 2.0* we store big input streams (by default, over 64K) in a {{temp}} file using {{CachedOutputStream}}. When you close the input stream, the temp file will be deleted. h4. Testing NMR camel routes can be tested using the camel unit test approach even if they will be deployed next in different bundles on an OSGI runtime. With this aim in view, you will extend the ServiceMixNMR Mock class {{org.apache.servicemix.camel.nmr.AbstractComponentClass}} which will create a NMR bus, register the Camel NMR Component and the endpoints defined into the Camel routes. {code} public class ExchangeUsingNMRTest extends AbstractComponentTest { @Test public void testProcessing() throws InterruptedException { MockEndpoint mock = getMockEndpoint(mock:simple); mock.expectedBodiesReceived(Simple message body); template.sendBody(direct:simple, Simple message body); assertMockEndpointsSatisfied(); } @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from(direct:simple).to(nmr:simple); from(nmr:simple?synchronous=true).to(mock:simple); } }; } } {code} {include:Endpoint See Also} Full Content NMR Component The nmr component is an adapter to the Normalized Message Router (NMR) in ServiceMix, which is intended for use by Camel applications deployed directly into the OSGi container. You can exchange objects with NMR and not only XML like this is the case with the JBI specification. The interest of this component is that you can interconnect camel routes deployed in different OSGI bundles. By contrast, the JBI component is intended for use by Camel applications deployed into the ServiceMix JBI container. Installing The NMR component is provided with Apache ServiceMix. It is not distributed with Camel. To install the NMR component in ServiceMix, enter the following command in the ServiceMix console window: features install nmr You also need to instantiate the NMR component. You can do this by editing your Spring configuration file, META-INF/spring/*.xml, and adding the following bean instance: beans xmlns:osgi="http://www.springframework.org/schema/osgi" ... ... bean id="nmr" class="org.apache.servicemix.camel.nmr.ServiceMixComponent" property name="nmr" osgi:reference interface="org.apache.servicemix.nmr.api.NMR" / /property /bean ... /beans
[CONF] Apache Camel NMR
NMR Page edited by charles Moulliard Changes (1) ... h4. Testing NMR camel routes can be tested using the camel unit test approach even if they will be deployed next in different bundles on an OSGI runtime. With this aim in view, you will extend the ServiceMixNMR Mock class {{org.apache.servicemix.camel.nmr.AbstractComponentClass}} {{org.apache.servicemix.camel.nmr.AbstractComponentTest}} which will create a NMR bus, register the Camel NMR Component and the endpoints defined into the Camel routes. {code} ... Full Content NMR Component The nmr component is an adapter to the Normalized Message Router (NMR) in ServiceMix, which is intended for use by Camel applications deployed directly into the OSGi container. You can exchange objects with NMR and not only XML like this is the case with the JBI specification. The interest of this component is that you can interconnect camel routes deployed in different OSGI bundles. By contrast, the JBI component is intended for use by Camel applications deployed into the ServiceMix JBI container. Installing The NMR component is provided with Apache ServiceMix. It is not distributed with Camel. To install the NMR component in ServiceMix, enter the following command in the ServiceMix console window: features install nmr You also need to instantiate the NMR component. You can do this by editing your Spring configuration file, META-INF/spring/*.xml, and adding the following bean instance: beans xmlns:osgi="http://www.springframework.org/schema/osgi" ... ... bean id="nmr" class="org.apache.servicemix.camel.nmr.ServiceMixComponent" property name="nmr" osgi:reference interface="org.apache.servicemix.nmr.api.NMR" / /property /bean ... /beans NMR consumer and producer endpoints The following code: from("nmr:MyServiceEndpoint") Automatically exposes a new endpoint to the bus with endpoint name MyServiceEndpoint (see URIformat). When an NMR endpoint appears at the end of a route, for example: to("nmr:MyServiceEndpoint") The messages sent by this producer endpoint are sent to the already deployed JBI endpoint. URI format nmr:endpointName URI Options Option Default Value Description runAsSubject false Apache ServiceMix 4.4: When this is set to true on a consumer endpoint, the endpoint will be invoked on behalf of the Subject that is set on the Exchange (i.e. the call to Subject.getSubject(AccessControlContext) will return the Subject instance) synchronous false When this is set to true on a consumer endpoint, an incoming, synchronous NMR Exchange will be handled on the sender's thread instead of being handled on a new thread of the NMR endpoint's thread pool timeout 0 Apache ServiceMix 4.4: When this is set to a value greater than 0, the producer endpoint will timeout if it doesn't receive a response from the NMR within the given timeout period (in milliseconds). Configuring a timeout value will switch to using synchronous interactions with the NMR instead of the usual asynchronous messaging. Examples Consumer from("nmr:MyServiceEndpoint") // consume nmr exchanges asynchronously from("nmr:MyServiceEndpoint?synchronous=true").to() // consume nmr exchanges synchronously and use the same thread as defined by NMR ThreadPool Producer from()...to("nmr:MyServiceEndpoint") // produce nmr exchanges asynchronously from()...to("nmr:MyServiceEndpoint?timeout=1") // produce nmr exchanges synchronously and wait till 10s to receive response Using Stream bodies If you are using a stream type as the message body, you should be aware that a stream is only capable of being read once. So if you enable DEBUG logging, the body is usually logged and thus read. To deal with this, Camel has a streamCaching option that can cache the stream, enabling you to read it multiple times. from("nmr:MyEndpoint").streamCaching().to("xslt:transform.xsl", "bean:doSomething"); From Camel 1.5 onwards, the stream caching is default enabled, so it is not necessary to set the streamCaching() option. In Camel 2.0 we store big input streams (by default, over 64K) in a temp file using CachedOutputStream. When you close the input stream, the temp file will be deleted. Testing NMR camel routes can be tested using the camel unit test approach even if they will be deployed next in different bundles on an OSGI runtime. With this aim in view, you will extend the ServiceMixNMR Mock class org.apache.servicemix.camel.nmr.AbstractComponentTest which will create a NMR bus, register the Camel NMR Component and the endpoints defined into the Camel routes. public class ExchangeUsingNMRTest extends AbstractComponentTest {
[CONF] Apache Camel NMR
NMR Page edited by Claus Ibsen Changes (2) ... {div:class=confluenceTableSmall} || Option || Default Value || Description || | {{runAsSubject}} | {{false}} | *Apache ServiceMix 4.4:* When this is set to *{{true}}* on a consumer endpoint, the endpoint will be invoked on behalf of the {{Subject}} that is set on the {{Exchange}} (i.e. the call to {{Subject.getSubject(AccessControlContext)}} will return the {{Subject}} instance) | | {{synchronous}} | {{false}} | When this is set to *{{true}}* on a consumer endpoint, an incoming, synchronous NMR Exchange will be handled on the senders thread instead of being handled on a new thread of the NMR endpoints thread pool | | {{timeout}} | {{0}} | *Apache ServiceMix 4.4:* When this is set to a value greater than 0, the producer endpoint will timeout if it doesnt receive a response from the NMR within the given timeout period (in milliseconds). Configuring a timeout value will switch to using synchronous interactions with the NMR instead of the usual asynchronous messaging. | {div} ... Full Content NMR Component The nmr component is an adapter to the Normalized Message Router (NMR) in ServiceMix, which is intended for use by Camel applications deployed directly into the OSGi container. By contrast, the JBI component is intended for use by Camel applications deployed into the ServiceMix JBI container. Installing The NMR component is provided with Apache ServiceMix. It is not distributed with Camel. To install the NMR component in ServiceMix, enter the following command in the ServiceMix console window: features install nmr You also need to instantiate the NMR component. You can do this by editing your Spring configuration file, META-INF/spring/*.xml, and adding the following bean instance: beans xmlns:osgi="http://www.springframework.org/schema/osgi" ... ... bean id="nmr" class="org.apache.servicemix.camel.nmr.ServiceMixComponent" property name="nmr" osgi:reference interface="org.apache.servicemix.nmr.api.NMR" / /property /bean ... /beans NMR consumer and producer endpoints The following code: from("nmr:MyServiceEndpoint") Automatically exposes a new endpoint to the bus with endpoint name MyServiceEndpoint (see URIformat). When an NMR endpoint appears at the end of a route, for example: to("nmr:MyServiceEndpoint") The messages sent by this producer endpoint are sent to the already deployed JBI endpoint. URI format nmr:endpointName URI Options Option Default Value Description runAsSubject false Apache ServiceMix 4.4: When this is set to true on a consumer endpoint, the endpoint will be invoked on behalf of the Subject that is set on the Exchange (i.e. the call to Subject.getSubject(AccessControlContext) will return the Subject instance) synchronous false When this is set to true on a consumer endpoint, an incoming, synchronous NMR Exchange will be handled on the sender's thread instead of being handled on a new thread of the NMR endpoint's thread pool timeout 0 Apache ServiceMix 4.4: When this is set to a value greater than 0, the producer endpoint will timeout if it doesn't receive a response from the NMR within the given timeout period (in milliseconds). Configuring a timeout value will switch to using synchronous interactions with the NMR instead of the usual asynchronous messaging. Examples from("nmr:MyServiceEndpoint") from("nmr:MyServiceEndpoint?synchronous=true").to("nmr:AnotherEndpoint") Using Stream bodies If you are using a stream type as the message body, you should be aware that a stream is only capable of being read once. So if you enable DEBUG logging, the body is usually logged and thus read. To deal with this, Camel has a streamCaching option that can cache the stream, enabling you to read it multiple times. from("nmr:MyEndpoint").streamCaching().to("xslt:transform.xsl", "bean:doSomething"); From Camel 1.5 onwards, the stream caching is default enabled, so it is not necessary to set the streamCaching() option. In Camel 2.0 we store big input streams (by default, over 64K) in a temp file using CachedOutputStream. When you close the input stream, the temp file will be deleted. See Also Configuring Camel Component Endpoint Getting Started Change Notification Preferences View Online | View Changes | Add Comment
[CONF] Apache Camel NMR
NMR Page edited by Gert Vanthienen Changes (2) ... {div:class=confluenceTableSmall} || Option || Default Value || Description || | {{runAsSubject}} | {{false}} | When this is set to *{{true}}* on a consumer endpoint, the endpoint will be invoked on behalf of the {{Subject}} that is set on the {{Exchange}} (i.e. the call to {{Subject.getSubject(AccessControlContext)}} will return the {{Subject}} instance) | | {{synchronous}} | {{false}} | When this is set to *{{true}}* on a consumer endpoint, an incoming, synchronous NMR Exchange will be handled on the senders thread instead of being handled on a new thread of the NMR endpoints thread pool | | {{timeout}} | {{0}} | When this is set to a value greater than 0, the producer endpoint will timeout if it doesnt receive a response from the NMR within the given timeout period (in milliseconds). Configuring a timeout value will switch to using synchronous interactions with the NMR instead of the usual asynchronous messaging. | {div} ... Full Content NMR Component The nmr component is an adapter to the Normalized Message Router (NMR) in ServiceMix, which is intended for use by Camel applications deployed directly into the OSGi container. By contrast, the JBI component is intended for use by Camel applications deployed into the ServiceMix JBI container. Installing The NMR component is provided with Apache ServiceMix. It is not distributed with Camel. To install the NMR component in ServiceMix, enter the following command in the ServiceMix console window: features install nmr You also need to instantiate the NMR component. You can do this by editing your Spring configuration file, META-INF/spring/*.xml, and adding the following bean instance: beans xmlns:osgi="http://www.springframework.org/schema/osgi" ... ... bean id="nmr" class="org.apache.servicemix.camel.nmr.ServiceMixComponent" property name="nmr" osgi:reference interface="org.apache.servicemix.nmr.api.NMR" / /property /bean ... /beans NMR consumer and producer endpoints The following code: from("nmr:MyServiceEndpoint") Automatically exposes a new endpoint to the bus with endpoint name MyServiceEndpoint (see URIformat). When an NMR endpoint appears at the end of a route, for example: to("nmr:MyServiceEndpoint") The messages sent by this producer endpoint are sent to the already deployed JBI endpoint. URI format nmr:endpointName URI Options Option Default Value Description runAsSubject false When this is set to true on a consumer endpoint, the endpoint will be invoked on behalf of the Subject that is set on the Exchange (i.e. the call to Subject.getSubject(AccessControlContext) will return the Subject instance) synchronous false When this is set to true on a consumer endpoint, an incoming, synchronous NMR Exchange will be handled on the sender's thread instead of being handled on a new thread of the NMR endpoint's thread pool timeout 0 When this is set to a value greater than 0, the producer endpoint will timeout if it doesn't receive a response from the NMR within the given timeout period (in milliseconds). Configuring a timeout value will switch to using synchronous interactions with the NMR instead of the usual asynchronous messaging. Examples from("nmr:MyServiceEndpoint") from("nmr:MyServiceEndpoint?synchronous=true").to("nmr:AnotherEndpoint") Using Stream bodies If you are using a stream type as the message body, you should be aware that a stream is only capable of being read once. So if you enable DEBUG logging, the body is usually logged and thus read. To deal with this, Camel has a streamCaching option that can cache the stream, enabling you to read it multiple times. from("nmr:MyEndpoint").streamCaching().to("xslt:transform.xsl", "bean:doSomething"); From Camel 1.5 onwards, the stream caching is default enabled, so it is not necessary to set the streamCaching() option. In Camel 2.0 we store big input streams (by default, over 64K) in a temp file using CachedOutputStream. When you close the input stream, the temp file will be deleted. See Also Configuring Camel Component Endpoint Getting Started Change Notification Preferences View Online | View Changes | Add Comment
[CONF] Apache Camel NMR
NMR Page edited by Gert Vanthienen Changes (1) ... {code} h4. URI Options || Option || Default Value || Description || | {{synchronous}} | {{false}} | When this is set to *{{true}}* on a consumer endpoint, an incoming, synchronous NMR Exchange will be handled on the senders thread instead of being handled on a new thread of the NMR endpoints thread pool | h4. Examples ... Full Content NMR Component The nmr component is an adapter to the Normalized Message Router (NMR) in ServiceMix, which is intended for use by Camel applications deployed directly into the OSGi container. By contrast, the JBI component is intended for use by Camel applications deployed into the ServiceMix JBI container. Installing The NMR component is provided with Apache ServiceMix. It is not distributed with Camel. To install the NMR component in ServiceMix, enter the following command in the ServiceMix console window: features install nmr You also need to instantiate the NMR component. You can do this by editing your Spring configuration file, META-INF/spring/*.xml, and adding the following bean instance: beans xmlns:osgi="http://www.springframework.org/schema/osgi" ... ... bean id="nmr" class="org.apache.servicemix.camel.nmr.ServiceMixComponent" property name="nmr" osgi:reference interface="org.apache.servicemix.nmr.api.NMR" / /property /bean ... /beans NMR consumer and producer endpoints The following code: from("nmr:endpoint:http://foo.bar.org/MyService/MyEndpoint") Automatically exposes a new endpoint to the bus, where the service QName is {http://foo.bar.org}MyService and the endpoint name is MyEndpoint (see URIformat). When an NMR endpoint appears at the end of a route, for example: to("nmr:endpoint:http://foo.bar.org/MyService/MyEndpoint") The messages sent by this producer endpoint are sent to the already deployed JBI endpoint. URI format nmr:service:serviceNamespace[sep]serviceName nmr:endpoint:serviceNamespace[sep]serviceName[sep]endpointName nmr:name:endpointName The separator that should be used in the endpoint URL is: / (forward slash), if serviceNamespace starts with http://, or : (colon), if serviceNamespace starts with urn:foo:bar. For more details of valid NMR URIs see the ServiceMix URI Guide. Using the nmr:service: or nmr:endpoint: URI formats sets the service QName on the JBI endpoint to the one specified. Otherwise, the default Camel JBI Service QName is used, which is: {http://activemq.apache.org/camel/schema/jbi}endpoint URI Options Option Default Value Description synchronous false When this is set to true on a consumer endpoint, an incoming, synchronous NMR Exchange will be handled on the sender's thread instead of being handled on a new thread of the NMR endpoint's thread pool Examples nmr:service:http://foo.bar.org/MyService nmr:endpoint:urn:foo:bar:MyService:MyEndpoint nmr:endpoint:http://foo.bar.org/MyService/MyEndpoint nmr:name:cheese Using Stream bodies If you are using a stream type as the message body, you should be aware that a stream is only capable of being read once. So if you enable DEBUG logging, the body is usually logged and thus read. To deal with this, Camel has a streamCaching option that can cache the stream, enabling you to read it multiple times. from("jbi:endpoint:http://foo.bar.org/MyService/MyEndpoint").streamCaching().to("xslt:transform.xsl", "bean:doSomething"); From Camel 1.5 onwards, the stream caching is default enabled, so it is not necessary to set the streamCaching() option. In Camel 2.0 we store big input streams (by default, over 64K) in a temp file using CachedOutputStream. When you close the input stream, the temp file will be deleted. See Also Configuring Camel Component Endpoint Getting Started Change Notification Preferences View Online | View Changes | Add Comment
[CONF] Apache Camel NMR
NMR Page edited by Gert Vanthienen Changes (11) ... {code} from(nmr:endpoint:http://foo.bar.org/MyService/MyEndpoint) from(nmr:MyServiceEndpoint) {code} Automatically exposes a new endpoint to the bus, where the service QName is {{\{http://foo.bar.org}MyService}} and the endpoint name is {{MyEndpoint}} (see [#URI-format]). Automatically exposes a new endpoint to the bus with endpoint name {{MyServiceEndpoint}} (see [#URI-format]). When an NMR endpoint appears at the end of a route, for example: {code} to(nmr:endpoint:http://foo.bar.org/MyService/MyEndpoint) to(nmr:MyServiceEndpoint) {code} ... {code} nmr:service:serviceNamespace[sep]serviceName nmr:endpoint:serviceNamespace[sep]serviceName[sep]endpointName nmr:name:endpointName nmr:endpointName {code} The separator that should be used in the endpoint URL is: * {{/}} (forward slash), if {{serviceNamespace}} starts with {{http://}}, or * {{:}} (colon), if {{serviceNamespace}} starts with {{urn:foo:bar}}. For more details of valid NMR URIs see the [ServiceMix URI Guide|http://servicemix.apache.org/uris.html]. Using the {{nmr:service:}} or {{nmr:endpoint:}} URI formats sets the service QName on the JBI endpoint to the one specified. Otherwise, the default Camel JBI Service QName is used, which is: {code} {http://activemq.apache.org/camel/schema/jbi}endpoint {code} h4. URI Options || Option || Default Value || Description || ... {code} nmr:service:http://foo.bar.org/MyService from(nmr:MyServiceEndpoint) nmr:endpoint:urn:foo:bar:MyService:MyEndpoint from(nmr:MyServiceEndpoint?synchronous=true).to(nmr:AnotherEndpoint) nmr:endpoint:http://foo.bar.org/MyService/MyEndpoint nmr:name:cheese {code} ... {code} from(jbi:endpoint:http://foo.bar.org/MyService/MyEndpoint).streamCaching().to(xslt:transform.xsl, from(nmr:MyEndpoint).streamCaching().to(xslt:transform.xsl, bean:doSomething); {code} ... Full Content NMR Component The nmr component is an adapter to the Normalized Message Router (NMR) in ServiceMix, which is intended for use by Camel applications deployed directly into the OSGi container. By contrast, the JBI component is intended for use by Camel applications deployed into the ServiceMix JBI container. Installing The NMR component is provided with Apache ServiceMix. It is not distributed with Camel. To install the NMR component in ServiceMix, enter the following command in the ServiceMix console window: features install nmr You also need to instantiate the NMR component. You can do this by editing your Spring configuration file, META-INF/spring/*.xml, and adding the following bean instance: beans xmlns:osgi="http://www.springframework.org/schema/osgi" ... ... bean id="nmr" class="org.apache.servicemix.camel.nmr.ServiceMixComponent" property name="nmr" osgi:reference interface="org.apache.servicemix.nmr.api.NMR" / /property /bean ... /beans NMR consumer and producer endpoints The following code: from("nmr:MyServiceEndpoint") Automatically exposes a new endpoint to the bus with endpoint name MyServiceEndpoint (see URIformat). When an NMR endpoint appears at the end of a route, for example: to("nmr:MyServiceEndpoint") The messages sent by this producer endpoint are sent to the already deployed JBI endpoint. URI format nmr:endpointName URI Options Option Default Value Description synchronous false When this is set to true on a consumer endpoint, an incoming, synchronous NMR Exchange will be handled on the sender's thread instead of being handled on a new thread of the NMR endpoint's thread pool Examples from("nmr:MyServiceEndpoint") from("nmr:MyServiceEndpoint?synchronous=true").to("nmr:AnotherEndpoint") Using Stream bodies If you are using a stream type as the message body, you should be aware that a stream is only capable of being read once. So if you enable DEBUG logging, the body is usually logged and thus read. To deal with this, Camel has a streamCaching option that can cache the stream, enabling you to read it multiple times. from("nmr:MyEndpoint").streamCaching().to("xslt:transform.xsl", "bean:doSomething"); From Camel 1.5 onwards, the stream caching is default enabled, so it is not necessary to set the streamCaching() option. In Camel 2.0 we store big input streams (by default, over 64K) in a temp file using CachedOutputStream. When you close the input stream, the temp file will be deleted. See Also
[CONF] Apache Camel NMR
NMR Page moved by Fintan Bolton From: Apache Camel To: Apache Camel Components Children moved Change Notification Preferences View Online | Add Comment
[CONF] Apache Camel NMR
NMR Page moved by Claus Ibsen From: Apache Camel To: Apache Camel Components Children moved Change Notification Preferences View Online | Add Comment