Issue might be related to my understanding of the concept too. ActionClass
is invoking proxy bean which is AccountingInterface
. Proxy bean interface is implemented with AccountingUtil
class. So I am expecting xml
returned by AccountingUtil
to be passed through seda:accountingQueue
and then streamed out on console.
ApplicationContext
<bean id="accountingInterface" class="org.apache.camel.spring.remoting.CamelProxyFactoryBean">
<property name="serviceUrl" value="seda:accountingQueue"/>
<property name="serviceInterface" value="acord.transaction.util.AccountingInterface"/>
</bean>
<route>
<from uri="seda:accountingQueue"/>
<setHeader headerName="nowInMillis">
<groovy>new Date().getTime()</groovy>
</setHeader>
<to uri="stream:out"/>
</route>
AccountingInterface
public interface AccountingInterface
{
void send(String xml);
String accountingUpdate(EDITDate accountingProcessDate);
}
AccountingUtil
public class AccountingUtil implements AccountingInterface
{
public String accountingUpdate(EDITDate accountingProcessDate)
{
//doSomething
return xml;
}
ActionClass
AccountingInterface accountingInterface = (AccountingInterface) AppContext.getBean("accountingInterface");
accountingInterface.accountingUpdate(accountingProcessDate);
But I am getting exception:
No body available of type: java.lang.String but has value: BeanInvocation public abstract java.lang.String acord.transaction.util.AccountingInterface.accountingUpdate(edit.common.EDITDate) with [2012/11/08]] of type: org.apache.camel.component.bean.BeanInvocation on: Message: BeanInvocation public abstract java.lang.String acord.transaction.util.AccountingInterface.accountingUpdate(edit.common.EDITDate) with [2012/11/08]]. Caused by: No type converter available to convert from type: org.apache.camel.component.bean.BeanInvocation to the required type: java.lang.String with value BeanInvocation public abstract java.lang.String acord.transaction.util.AccountingInterface.accountingUpdate(edit.common.EDITDate) with [2012/11/08]]. Exchange[Message: BeanInvocation public abstract java.lang.String acord.transaction.util.AccountingInterface.accountingUpdate(edit.common.EDITDate) with [2012/11/08]]]. Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type converter available to convert from type: org.apache.camel.component.bean.BeanInvocation to the required type: java.lang.String with value BeanInvocation public abstract java.lang.String acord.transaction.util.AccountingInterface.accountingUpdate(edit.common.EDITDate) with [2012/11/08]]]
at org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:101)
One more issue Can I have multiple serviceURL
for single proxyBean(interface)
?
I want different method to call different serviceURL
but part of a single interface.