camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem Jiang <willem.ji...@gmail.com>
Subject Re: Question using OSGI / Bean / osgi:service
Date Thu, 06 May 2010 09:42:04 GMT
Hi Charles,

Maybe something is wrong with the OSGi service which is consumed within 
Spring DM. I need to dig your test case for it.

Can you try to using the interface name 
"com.goodyear.emea.gicl.esb.service.Persistence" instead of 
"sapPersistence" as the camel-bean's name ? As camel-osgi supports to 
access the OSGi service within Camel context.

Willem


Charles Moulliard wrote:
> Hi,
> 
> I have created a camel Bean which is exposed as a spring DM service
> 
> public interface Persistence {
> 	
> 	public void save(@Body FinishedTireDocument finishedTiredDocument,
> Exchange ecxh);
> 
> }
> 
> public class PersistenceImpl implements Persistence {
> 	
> 	private SapDocumentDAO sapDocumentDAO;
> 
> 	public void save(@Body FinishedTireDocument finishedTiredDocument,
> Exchange ecxh) {
> 		
> 		getSapDocumentDAO().save(finishedTiredDocument);
> 		
> 	}
> 
> 	public SapDocumentDAO getSapDocumentDAO() {
> 		return sapDocumentDAO;
> 	}
> 
> 	public void setSapDocumentDAO(SapDocumentDAO sapDocumentDAO) {
> 		this.sapDocumentDAO = sapDocumentDAO;
> 	}
> 	
> }
> 
> Spring config
> 
> 	<bean id="sapServiceImpl"
> class="com.goodyear.emea.gicl.esb.service.impl.PersistenceImpl">
> 		<property name="sapDocumentDAO">
> 			<osgi:reference
> interface="com.goodyear.emea.gicl.esb.persistence.SapDocumentDAO"/>
> 		</property>
> 	</bean>
> 	
> 	<osgi:service ref="sapServiceImpl"
> interface="com.goodyear.emea.gicl.esb.service.Persistence"/>
> 
> The service is called from a camel route like this :
> 
> 	public void configure() throws Exception {
> 		
> 		/**
> 		 * Route persisting objects in DB
> 		 */
> 		 from(queueValidatedUri)
> 		 .bean("sapPersistence", "save")
> 		 .to(queueValidatedUri);
> 	}
> 
> Spring config
> 
>     <osgi:reference id="sapPersistence"
> interface="com.goodyear.emea.gicl.esb.service.Persistence"/>
> 
> Unfortunately, I get this error.
> 
> Caused by: org.apache.camel.component.bean.MethodNotFoundException:
> Method with name: save not found on bean: sapPersistence
> 
> Is it allowed to exposed a camel bean like that ?
> 
> Kind regards,
> 
> Charles Moulliard
> 
> Senior Enterprise Architect (J2EE, .NET, SOA)
> Apache Camel Committer
> 
> *******************************************************************
> - Blog : http://cmoulliard.blogspot.com
> - Twitter : http://twitter.com/cmoulliard
> - Linkedlin : http://www.linkedin.com/in/charlesmoulliard
> 


Mime
View raw message