Hi,
it's normal, you can't deploy a SU zip.
To be able to deploy it, you need to package your SUs into a SA zip.
It's the SA zip file which is deployed.
To make a SA, you can use the following pom.xml:
<project ...>
<modelVersion>4.0.0</modelVersion>
<groupId>my</groupId>
<artifactId>sa</artifactId>
<version>1.0-SNAPSHOT</version>
<package>jbi-service-assembly</package>
<dependencies>
<dependency>
<groupId>my</groupId>
<artifactId>su1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>my</groupId>
<artifactId>su2</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>jbi-maven-plugin</artifactId>
<version>4.1</version>
<extensions>true</extensions>
<configuration>
<type>service-assembly</type>
</configuration>
</plugin>
</plugins>
</build>
</project>
Make:
mvn clean install
and deploy the resulting sa zip file.
Only the SU is quite useless.
Regards
JB
FuinhaAzul wrote:
I gived a few tries, but when I put the SU in the hotdeploy folder, nothing
happen. Not even the debug output from mailPoller is show! (I didn´t
undertand where is the "main" that servicemix look to start an application
in the hotdeploy folder)
Let I say the actual needs...
My research need is to build a simple example ( in this time can be with
lightweight container) that take a XML from a email, take a tag inside the
xml to decide which system folder the XML will be write.
I have 2 days left to finish this. If I suceded, then the company that i
work, will let I spend more time to really understand concepts like JBI
packaging structure, Maven ...
So, can you guys help me to build this example? I promisse that I will be on
my own soon! :-)
OBS: Sorry for my bad English.
Jean-Baptiste Onofré wrote:
Well,
I take the example of the mail SU.
In eclipse, create a Java project (New -> Java Project).
Name the project "mail-su".
Now in the mail-su project, create a file named pom.xml and containing:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.servicemix.samples</groupId>
<artifactId>mail-su</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jbi-service-unit</packaging>
<dependencies>
<dependency>
<groupId>org.apache.servicemix</groupId>
<artifactId>servicemix-mail</artifactId>
<version>2009.01</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>jbi-maven-plugin</artifactId>
<version>4.1</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
After, in the mail-su project, you create a directory src/main/resources
and you put the xbean.xml in this directory.
Once done, you can make:
mvn clean install eclipse:eclipse
The install goal will create the SU zip (that can be embedded in the SA)
and eclipse:eclipse goal will setup the project to be eclipse compliant.
Make a eclipse project refresh and it should be fine :)
Regards
JB
FuinhaAzul wrote:
Great answer... This helped me to understant the diference between using
the
servicemix file and a SA package.
I´m using eclipse to develop the project, but i´m not familiar with
maven,
just with ant. But i have instaled maven and give a few tries.
My problem is how to create the JBI projects in eclipse...
Maybe can you help me, which maven commands I need to run, to build this
project? (I want to create a right package structure, without using ant
again)
Thanks in advance!
Jean-Baptiste Onofré wrote:
Hi,
I recommand to avoid the usage of the lightweight container and prefer
the pure JBI form.
In your case, you need to define two SUs:
1/ a mail poller SU
2/ a file sender (writer)
Concerning the mail poller, you can define the following xbean.xml:
<beans xmlns:my="http://www.example.org/myService"
xmlns:mail="http://servicemix.apache.org/mail/1.0">
<mail:poller service="my:MailService" endpoint="MailPoller"
targetService="my:MailService"
targetEndpoint="MailFileWriter"
period="10000"
connection="imap://[email protected]:143/INBOX?password=xxxx"
deleteProcessedMessages="false"
processOnlyUnseenMessages="true"/>
</beans>
Create a maven project with this xbean as resources.
On the file endpoint side, you can define the following xbean.xml:
<beans xmlns:my="http://www.example.org/myService"
xmlns:file="http://servicemix.apache.org/file/1.0">
<file:sender service="my:MailService" endpoint="MailFileWriter"
directory="file:/tmp/mailFiles"/>
</beans>
After that you can assemble both SU (the mail poller and file sender)
into a SA and create the SA zip file.
Once done, you can deploy the SA zip file by copying it into the
hotdeploy directory (if you use SMX3).
Regards
JB
FuinhaAzul wrote:
Hi there.
I´m trying to create a servicemix application that takes a email and
put
the
content on a file. But i´m not understand how. I did the file-binding
sample, but I´m not suceded to adapt this sample to use email.
This is waht I did:
servicemix.xml:
<beans xmlns:sm="http://servicemix.apache.org/config/1.0"
xmlns:foo="http://servicemix.org/demo/"
xmlns:mail="http://servicemix.apache.org/mail/1.0">
<bean id="jndi"
class="org.apache.xbean.spring.jndi.SpringInitialContextFactory"
factory-method="makeInitialContext" singleton="true" />
<!-- the JBI container -->
<sm:container id="jbi" useMBeanServer="true" createMBeanServer="true">
<sm:activationSpecs>
<!-- Write files to the outbox directory -->
<sm:activationSpec componentName="fileSender"
service="foo:fileSender">
<sm:component>
<bean
class="org.apache.servicemix.components.file.FileWriter">
<property name="directory"
value="outbox" />
</bean>
</sm:component>
</sm:activationSpec>
<sm:activationSpec componentName="emailPoller"
service="emailPoller"
destinationService="foo:fileSender">
<sm:component>
<bean
class="org.apache.servicemix.components.email.MimeMailPoller">
<property name="hostName"
value="xxxxx" />
<property name="password"
value="xxxx" />
<property name="userName"
value="xxx" />
<property name="debug"
value="true" />
</bean>
</sm:component>
</sm:activationSpec>
</sm:activationSpecs>
</sm:container>
</beans>