You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by Guillaume Nodet <gn...@gmail.com> on 2007/03/02 13:57:42 UTC

Re: Usage of lightweight components?

FYI, the servicemix-bean component can act as a complete
replacement of the lightweight components / lightweight container,
while being a compliant SE.
I have began to document it:
  http://cwiki.apache.org/SM/servicemix-bean.html

The possibilities of this component are endless.  Especially if we can find
a way to use the concept of BeanFlow there (or maybe something alike
with the use of annotations) ...

On 3/1/07, Terry Cox <te...@meta-concepts.com> wrote:
> > What are the advantages of using 'real' components?
>
> It is very simple to build a single business story in a LW manner, however there
> are constraints upon the way you can deploy LW components. Dependencies of LW
> components must be managed manually and all component definitions are in the
> same servicemix.xml file.
>
> Once you start to reach an environment where you have multiple, independent
> business stories , each deployed with their own lifecycle, a mechanism is
> required to simplify deployment and management.
>
> Full components can be deployed using the JBI Service Unit / Service Assembly
> pattern and each SA can be managed independently.
>
> --
> Terry Cox
> Meta-Concepts Ltd
>
>


-- 
Cheers,
Guillaume Nodet
------------------------
Architect, LogicBlaze (http://www.logicblaze.com/)
Blog: http://gnodet.blogspot.com/

Re: Usage of lightweight components?

Posted by Gert Vanthienen <ge...@skynet.be>.
L.S.,


Forwarding this message to the users mailing list, because it isn't 
really related to development of ServiceMix itself...

If you want to deploy a JMS consumer endpoint, you should do so in a SU 
that targets servicemix-jms.  In your case, you should have two SUs, one 
targeted at servicemix-bean and another targeted at servicemix-jms.

Your SA should contain both SU archives, as well as a jbi.xml file that 
specifies the JBI component to target.  Can you check if your SA has 
this file and the necessary information in it?  Does ServiceMix also log 
the SU being deployed succesfully?


Gert

kiwisurfer wrote:
> Hi,
> 
> Can someone explain the relationship between deployment and registration?
> 
>>>From earlier posts about lightweight components, it was suggested that the
> servicemix-beancontainer was a more full featured component for hosting
> light weight objects. So I have written a simple SA and a SU, that is hosted
> via the servicemix-beancontainer. 
> 
> My xbean.xml file in the SU exposes 2 endpoints: a standard JMS consumer,
> and a bean endpoint that points to my ComponentSupport derived class.
> 
> Having dropped the SA into the hot deploy folder, ServiceMix logs that the
> SA was successfully deployed. When using a JMX console, I don't see the JMS
> endpoint or my bean endpoint and therefore assume that my SA did not
> successfully register these endpoints.
> 
> This may well have something to do with configuration not being correct, but
> I am unsure at this point how ServiceMix carries out this step, and
> therefore what I need to be looking for to correct.
> 
> 
> xbean.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns:bean="http://servicemix.apache.org/bean/1.0"
>        xmlns:lb="http://mine.com/catalogService"
>        xmlns:jms="http://servicemix.apache.org/jms/1.0">
> 
>  <jms:endpoint service="test:MyConsumerService"
>               endpoint="jms"
>               targetService="test:MyConsumerService"
>               targetEndpoint="endpoint"
>               role="consumer" 
>               destinationStyle="queue"
>               jmsProviderDestinationName="queue/A"
>               jndiConnectionFactoryName="ConnectionFactory"
>               defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
>               defaultOperation="test:Echo" 
>               description="My first test"/>
> 
>   <bean:endpoint service="mine:catalogService" endpoint="endpoint"
> bean="#catalogServiceBean"/>
>   <bean id="catalogServiceBean"
> class="com.mine.streamline.CatalogServiceEngineImpl"/>
> </beans>

Re: Usage of lightweight components?

Posted by kiwisurfer <uk...@yahoo.co.uk>.
Hi,

Can someone explain the relationship between deployment and registration?

>From earlier posts about lightweight components, it was suggested that the
servicemix-beancontainer was a more full featured component for hosting
light weight objects. So I have written a simple SA and a SU, that is hosted
via the servicemix-beancontainer. 

My xbean.xml file in the SU exposes 2 endpoints: a standard JMS consumer,
and a bean endpoint that points to my ComponentSupport derived class.

Having dropped the SA into the hot deploy folder, ServiceMix logs that the
SA was successfully deployed. When using a JMX console, I don't see the JMS
endpoint or my bean endpoint and therefore assume that my SA did not
successfully register these endpoints.

This may well have something to do with configuration not being correct, but
I am unsure at this point how ServiceMix carries out this step, and
therefore what I need to be looking for to correct.


xbean.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:bean="http://servicemix.apache.org/bean/1.0"
       xmlns:lb="http://mine.com/catalogService"
       xmlns:jms="http://servicemix.apache.org/jms/1.0">

 <jms:endpoint service="test:MyConsumerService"
              endpoint="jms"
              targetService="test:MyConsumerService"
              targetEndpoint="endpoint"
              role="consumer" 
              destinationStyle="queue"
              jmsProviderDestinationName="queue/A"
              jndiConnectionFactoryName="ConnectionFactory"
              defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
              defaultOperation="test:Echo" 
              description="My first test"/>

  <bean:endpoint service="mine:catalogService" endpoint="endpoint"
bean="#catalogServiceBean"/>
  <bean id="catalogServiceBean"
class="com.mine.streamline.CatalogServiceEngineImpl"/>
</beans>
-- 
View this message in context: http://www.nabble.com/Re%3A-Usage-of-lightweight-components--tf3333483s12049.html#a11755541
Sent from the ServiceMix - Dev mailing list archive at Nabble.com.


Re: Usage of lightweight components?

Posted by Eduardo Burgos <eb...@gmail.com>.
Hi there,

I just began trying servicemix-bean and I remembered this thread.

Is there a way that endpoints could be autodiscovered while deploying as a
service unit?
maybe putting something in xbean.xml like this:

<bean:autodiscover package="org.apache.servicemix" />

at the moment, if I'm using service units, the @Endpoint annotation has no
use? right?




On 3/4/07, Guillaume Nodet <gn...@gmail.com> wrote:
>
> I will try to further document it, but any ideas or feedback is
> welcome (on both documentation and the component itself).
>
> On Sat, 3 Mar 2007 21:03 +0000 (GMT Standard Time), Terry Cox
> <te...@meta-concepts.com> wrote:
> > > the servicemix-bean component
> >
> > I had spotted that in the source, and have been awaiting some
> > documentation with keen interest.
> >
> > Terry
> >
>
>
> --
> Cheers,
> Guillaume Nodet
> ------------------------
> Architect, LogicBlaze (http://www.logicblaze.com/)
> Blog: http://gnodet.blogspot.com/
>

Re: Usage of lightweight components?

Posted by Guillaume Nodet <gn...@gmail.com>.
I will try to further document it, but any ideas or feedback is
welcome (on both documentation and the component itself).

On Sat, 3 Mar 2007 21:03 +0000 (GMT Standard Time), Terry Cox
<te...@meta-concepts.com> wrote:
> > the servicemix-bean component
>
> I had spotted that in the source, and have been awaiting some
> documentation with keen interest.
>
> Terry
>


-- 
Cheers,
Guillaume Nodet
------------------------
Architect, LogicBlaze (http://www.logicblaze.com/)
Blog: http://gnodet.blogspot.com/

Re: Usage of lightweight components?

Posted by Terry Cox <te...@meta-concepts.com>.
> the servicemix-bean component

I had spotted that in the source, and have been awaiting some
documentation with keen interest. 

Terry

Re: Usage of lightweight components?

Posted by Gert Vanthienen <ge...@skynet.be>.
Jason,

The correct component-name is servicemix-bean.  Isn't the console 
showing warnings about JBI Components that are not installed yet? (Like 
mentioned on 
http://incubator.apache.org/servicemix/16-beginner-exercise.html)

If so, copy the required components to the install/ directory to to 
install them and resume the the deployment of your SA.

Gert

kiwisurfer wrote:
> My apologies for posting to wrong forum... its was 02:30am, and I was a
> little tired. :-)
> 
> Thanks for your post and the info on the seperate SUs. I have done this and
> made the change to the jbi.xml file as below.
> 
> Using MC4J console I can see the service assembly registered, but no service
> units. This is what I am assuming is the heart of why I am not seeing my JMS
> queue or Bean component.... the SUs are seemingly not registering any of
> their contents. 
> 
> The log for ServiceMix definitely shows a "Finished installation of archive:
> CatalogService.zip" message by the AutoDeploymentService on the log.
> 
> Is it possible for the SA to register, and the SUs not to? And any ideas as
> to why both SUs are not registering?
> 
> Kind regards,
> Jason
> ------------
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <jbi xmlns="http://java.sun.com/xml/ns/jbi" version="1.0">
>    <service-assembly>
>      <identification>
>        <name>catalogService</name>
>        <description>CatalogService Service Assembly</description>
>      </identification>
>      <service-units>  
> 		<service-unit>
>        		<identification>
>         		<name>catalogBeanService</name>
>          		<description>CatalogService Service Unit</description>
>        		</identification>
>        		<target>
>          		<artifacts-zip>catalogservice-su.zip</artifacts-zip>
>          		<component-name>servicemix-beancontainer</component-name>
>        		</target>
>    		</service-unit>          	
>    		<service-unit>
>        		<identification>
>         		<name>catalogJMSService</name>
>          		<description>CatalogService JMS Service Unit</description>
>        		</identification>
>        		<target>
>          		<artifacts-zip>catalogservice-jms-su.zip</artifacts-zip>
>          		<component-name>servicemix-jms</component-name>
>        		</target>
>    		</service-unit>
>    	</service-units>	
>     </service-assembly>
> </jbi>
> 
> 
> 

RE: Usage of lightweight components?

Posted by ra...@wipro.com.
I think there are certain issues with your xbean configurations.

You have used namespaces "test" and "mine"(ex:
service="test:MyConsumerService") without declaring them.. Can you
declare these namespaces and try...

 


Regards,
Rabi Mishra, 
http://rabisblog.blogspot.com/
c++; /* this makes c bigger but returns the old value */ 
-----Original Message-----
From: kiwisurfer [mailto:ukkiwisurfer@yahoo.co.uk] 
Sent: Tuesday, July 24, 2007 2:34 PM
To: servicemix-users@geronimo.apache.org
Subject: Re: Usage of lightweight components?


My apologies for posting to wrong forum... its was 02:30am, and I was a
little tired. :-)

Thanks for your post and the info on the seperate SUs. I have done this
and made the change to the jbi.xml file as below.

Using MC4J console I can see the service assembly registered, but no
service units. This is what I am assuming is the heart of why I am not
seeing my JMS queue or Bean component.... the SUs are seemingly not
registering any of their contents. 

The log for ServiceMix definitely shows a "Finished installation of
archive:
CatalogService.zip" message by the AutoDeploymentService on the log.

Is it possible for the SA to register, and the SUs not to? And any ideas
as to why both SUs are not registering?

Kind regards,
Jason
------------

<?xml version="1.0" encoding="UTF-8"?>
<jbi xmlns="http://java.sun.com/xml/ns/jbi" version="1.0">
   <service-assembly>
     <identification>
       <name>catalogService</name>
       <description>CatalogService Service Assembly</description>
     </identification>
     <service-units>  
		<service-unit>
       		<identification>
        		<name>catalogBeanService</name>
         		<description>CatalogService Service
Unit</description>
       		</identification>
       		<target>
 
<artifacts-zip>catalogservice-su.zip</artifacts-zip>
 
<component-name>servicemix-beancontainer</component-name>
       		</target>
   		</service-unit>          	
   		<service-unit>
       		<identification>
        		<name>catalogJMSService</name>
         		<description>CatalogService JMS Service
Unit</description>
       		</identification>
       		<target>
 
<artifacts-zip>catalogservice-jms-su.zip</artifacts-zip>
         		<component-name>servicemix-jms</component-name>
       		</target>
   		</service-unit>
   	</service-units>	
    </service-assembly>
</jbi>



--
View this message in context:
http://www.nabble.com/Usage-of-lightweight-components--tf3325766s12049.h
tml#a11759261
Sent from the ServiceMix - User mailing list archive at Nabble.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

Re: Usage of lightweight components?

Posted by Gert Vanthienen <ge...@skynet.be>.
Jason,


I think you already had these tags in the jbi.xml that you posted earlier.

Have you already copied the required components into the install/ 
directory?  If so, can you post the logging output between
INFO  - AutoDeploymentService          - Directory: deploy: Archive 
changed: processing xxx-sa-3.2-incubating-SNAPSHOT.zip ..
and
INFO  - AutoDeploymentService          - Directory: deploy: Finished 
installation of archive:  xxx-sa-3.2-incubating-SNAPSHOT.zip


Gert

kiwisurfer wrote:
> So far it appears that the jbi.xml in the SA requires there to be the tags:
> 
> <service-units> 
>    
> </service-units>
> 
> Between which the service units are defined. This seems to allow the service
> assembly to register. This is not clearly described in the documentation. I
> am running ServiceMix 3.1.1. 
> 
> However, the components defined in the SUs are not registering either for my
> SA, or even the loan-broker SA, that was built using the default ant build
> file (that ships as part of the examples). 
> 
> Any ideas?
> 
> 

Re: Usage of lightweight components?

Posted by kiwisurfer <uk...@yahoo.co.uk>.
So far it appears that the jbi.xml in the SA requires there to be the tags:

<service-units> 
   
</service-units>

Between which the service units are defined. This seems to allow the service
assembly to register. This is not clearly described in the documentation. I
am running ServiceMix 3.1.1. 

However, the components defined in the SUs are not registering either for my
SA, or even the loan-broker SA, that was built using the default ant build
file (that ships as part of the examples). 

Any ideas?


-- 
View this message in context: http://www.nabble.com/Usage-of-lightweight-components--tf3325766s12049.html#a11759667
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Usage of lightweight components?

Posted by Gert Vanthienen <ge...@skynet.be>.
Jason,

Yes, normally, you should have gotten a warning about this (similar to 
the one in the tutorial page I referred to earlier)

Gert

kiwisurfer wrote:
> Gert,
> 
>> The correct component-name is servicemix-bean
> 
> Yes, thanks I picked up on that one, not long after my post, as well as the
> non matching namespaces. 
> 
> I just managed to get the serviceunit to deploy! Actually the problem seemed
> to be that I hadn't installed the servicemix-shared installer. Once that was
> installed, the SUs registered. 
> 
>>>From what you had mentioned, should there have been a warning if this was
> not installed and required?
> 
> 

Re: Lightweight JMS

Posted by kiwisurfer <uk...@yahoo.co.uk>.
Found the error. It appears that the example code from the loans-broker-bpel
JMSClient is missing the following on the request string:

String request ="<?xml version='1.0' encoding='UTF-8'?>String request =
....... "


-- 
View this message in context: http://www.nabble.com/Usage-of-lightweight-components--tf3325766s12049.html#a11770208
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Lightweight JMS

Posted by kiwisurfer <uk...@yahoo.co.uk>.
I have managed to get a simple ServiceMix config sort of working:

JMS -> NMR-> Bean

My bean is hosted by the servicemix-bean component, and implements the
MessageExchangeListener interface, and also uses the @Resource annotations
to store the DeliveryChannel instance. It is deployed as part of a SA/SU,
and I can see the endpoints, queues and SA/SUs registered via MC4J.


public class CatalogServiceEngineImpl implements MessageExchangeListener {

	private static final Log log =
LogFactory.getLog(CatalogServiceEngineImpl.class);
	private ExternalCatalog catalogProvider;
	
	@Resource
	private DeliveryChannel channel;	

        public void onMessageExchange(MessageExchange exchange) throws
MessagingException 
	{
		if (exchange.getStatus() == ExchangeStatus.ACTIVE) 
		{
			log.info("Received message " + exchange);
			NormalizedMessage message = exchange.getMessage("in");
			ExchangeStatus outgoingStatus = ExchangeStatus.DONE;
			
			log.info("About to get operation id ");
			Integer operationId = (Integer) message.getProperty("operationId");
			log.info("Checking operation Id ");
			
			if (operationId != null)
			{
				log.info("OperationId= " + operationId);
			}
			
			exchange.setStatus(outgoingStatus);
			channel.send(exchange);
		}
	}
}
	
I am trying to invoke the Bean service through a JMSClient (taken from 
loans-broker-bpel), with a simple message that has only one property called
operationId.

However, i get the following stack trace:

ERROR - MultiplexingConsumerProcessor  - Error while handling jms message
java.lang.NullPointerException
        at
org.apache.servicemix.jms.AbstractJmsProcessor.toNMS(AbstractJmsProce
ssor.java:172)
        at
org.apache.servicemix.jms.multiplexing.MultiplexingConsumerProcessor.
access$300(MultiplexingConsumerProcessor.java:40)
        at
org.apache.servicemix.jms.multiplexing.MultiplexingConsumerProcessor$
1.run(MultiplexingConsumerProcessor.java:93)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.runTask(ThreadPoolExecutor.java:665)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.run(ThreadPoolExecutor.java:690)
        at java.lang.Thread.run(Thread.java:595)

Any ideas?

-- 
View this message in context: http://www.nabble.com/Usage-of-lightweight-components--tf3325766s12049.html#a11769691
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Usage of lightweight components?

Posted by kiwisurfer <uk...@yahoo.co.uk>.
Gert,

>The correct component-name is servicemix-bean

Yes, thanks I picked up on that one, not long after my post, as well as the
non matching namespaces. 

I just managed to get the serviceunit to deploy! Actually the problem seemed
to be that I hadn't installed the servicemix-shared installer. Once that was
installed, the SUs registered. 

>From what you had mentioned, should there have been a warning if this was
not installed and required?


-- 
View this message in context: http://www.nabble.com/Usage-of-lightweight-components--tf3325766s12049.html#a11760211
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Usage of lightweight components?

Posted by kiwisurfer <uk...@yahoo.co.uk>.
My apologies for posting to wrong forum... its was 02:30am, and I was a
little tired. :-)

Thanks for your post and the info on the seperate SUs. I have done this and
made the change to the jbi.xml file as below.

Using MC4J console I can see the service assembly registered, but no service
units. This is what I am assuming is the heart of why I am not seeing my JMS
queue or Bean component.... the SUs are seemingly not registering any of
their contents. 

The log for ServiceMix definitely shows a "Finished installation of archive:
CatalogService.zip" message by the AutoDeploymentService on the log.

Is it possible for the SA to register, and the SUs not to? And any ideas as
to why both SUs are not registering?

Kind regards,
Jason
------------

<?xml version="1.0" encoding="UTF-8"?>
<jbi xmlns="http://java.sun.com/xml/ns/jbi" version="1.0">
   <service-assembly>
     <identification>
       <name>catalogService</name>
       <description>CatalogService Service Assembly</description>
     </identification>
     <service-units>  
		<service-unit>
       		<identification>
        		<name>catalogBeanService</name>
         		<description>CatalogService Service Unit</description>
       		</identification>
       		<target>
         		<artifacts-zip>catalogservice-su.zip</artifacts-zip>
         		<component-name>servicemix-beancontainer</component-name>
       		</target>
   		</service-unit>          	
   		<service-unit>
       		<identification>
        		<name>catalogJMSService</name>
         		<description>CatalogService JMS Service Unit</description>
       		</identification>
       		<target>
         		<artifacts-zip>catalogservice-jms-su.zip</artifacts-zip>
         		<component-name>servicemix-jms</component-name>
       		</target>
   		</service-unit>
   	</service-units>	
    </service-assembly>
</jbi>



-- 
View this message in context: http://www.nabble.com/Usage-of-lightweight-components--tf3325766s12049.html#a11759261
Sent from the ServiceMix - User mailing list archive at Nabble.com.