Rabi,
Could you post a full stack trace to determine the cause? I see two
possibilities (and it's probably even a combination of both):
- If you use a ServiceMix File endpoint, by default it will send it's
content as a StreamSource for performance reasons, so you risk running
into this
(http://servicemix.apache.org/javaioioexception-stream-closed.html) when
one of your components in the flow re-reads the same message multiple times.
- What kind of custom converter have you build (from which type to
PersonDocument.class)? As I explained before, the message content sent
by the ServiceMix File component is in a different format than the one
sent by a plain Camel route. E.g. if you have a converter from String
to PersonDocument, you might have to add another
convertBodyTo(String.class) to transform the StreamSource into a String.
Regards,
Gert
rabi wrote:
Gret,
I am using Servicemix 3.3-SNAPSHOT build from trunk and Camel 3.1 SNAPSHOT.
Here are the deatils..
--------------------------
All Camel example with the following Route works fine
from("file:inbox/data1?noop=true").convertBodyTo(PersonDocument.class)
// .intercept(transactionInterceptor())
.to("jpa:org.apache.camel.example.etl.CustomerEntity");
When I change this use smx filepoller with the following route, this gives
me errors as it is not able to convert the types. I am using a
servicemix-bean inbetween (passthrough)
from("jbi:endpoint:http://camel.apache.org/example/etl/persist/person")
.convertBodyTo(PersonDocument.class)
// .intercept(transactionInterceptor())
.to("jpa:org.apache.camel.example.etl.CustomerEntity");
fillePoller su config..
-------------------------
<beans xmlns:file="http://servicemix.apache.org/file/1.0"
xmlns:ls="http://servicemix.apache.org/samples/logging-sample">
<file:poller service="ls:filePoller"
endpoint="poller"
targetService="ls:beanRouter"
targetEndpoint="router"
file="inbox/data1"> </file:poller> </beans>
Bean su
----------------
<beans xmlns:bean="http://servicemix.apache.org/bean/1.0"
xmlns:ls="http://servicemix.apache.org/samples/logging-sample">
<bean:endpoint service="ls:beanRouter" endpoint="router">
<bean:bean>
<bean class="org.apache.servicemix.samples.logging.BeanRouter" />
</bean:bean>
</bean:endpoint>
</beans>
Bean su code..
----------------------
public void onMessageExchange(MessageExchange exchange) throws
MessagingException {
InOnly in = (InOnly) exchange;
if (in.getStatus() == ExchangeStatus.DONE) {
return;
} else if (in.getStatus() == ExchangeStatus.ERROR) {
return;
}
System.err.println(in.getService().getLocalPart() + " requested");
try {
NormalizedMessage message = exchange.getMessage("in");
Source content = message.getContent();
QName targetService = new
QName("http://camel.apache.org/example/etl","persist");
MessageExchangeFactory exchangeFact =
channel.createExchangeFactoryForService(targetService);
InOnly response = exchangeFact.createInOnlyExchange();
NormalizedMessage jpaMessage = response.createMessage();
jpaMessage.setContent(content);
response.setInMessage(jpaMessage);
channel.sendSync(response);
exchange.setStatus(ExchangeStatus.DONE);
channel.send(exchange);
} catch (Exception e) {
in.setError(e);
channel.sendSync(in);
}
}
Regards,
Rabi
Gert Vanthienen wrote:
Rabi Mishra,
What version of ServiceMix are you using? This sounds like an issue
from ServiceMix 3.2.0, which has been solved in 3.2.1 however. Can you
post the xbean.xml for the file SU as well as the Camel route?
Regards,
Gert
[EMAIL PROTECTED] wrote:
Hi,
TypeConverters (including the custom TypeConverters) are not loaded when
using "Camel JBI Endpoint" from as a target from servicemix component.
servicemix-file->camel-jpa
This issue does not arise when the complete flow is in Camel (in the
RouteBuilder).
camel-file->camel-jpa
Any thoughts..
Regards,
Rabi Mishra
Wipro Technologies
Hinjewadi, Pune
Cell: +91(0)9765391877
http://rabisblog.blogspot.com/
The information contained in this electronic message and any attachments
to this message are intended for the exclusive use of the addressee(s)
and may contain proprietary, confidential or privileged information. If
you are not the intended recipient, you should not disseminate,
distribute or copy this e-mail. Please notify the sender immediately and
destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient
should check this email and any attachments for the presence of viruses.
The company accepts no liability for any damage caused by any virus
transmitted by this email.
www.wipro.com
-----
---
Gert Vanthienen
http://www.anova.be