Yang,

I'm sending my example. Tell me if it works fine for you. I remove my
marshaller because its function is to take some part of the message for the
drools component. When the message returns the same marshaller change the
message from the drools adding mail atributes.
I started testing without drools just using servicemix-bean printing the
message received It's great to find out what you get from the mail
component.
Please let me know if I anything I can help you.
And please excuse my poor sintaxis. I have to practice my English writing.

Regards,
Zaca

*Mail-su xbean*
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns:mail="http://servicemix.apache.org/mail/1.0";
    xmlns:mailsvc="http://yourUrl";
    xmlns="http://www.springframework.org/schema/beans";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://servicemix.apache.org/mail/1.0
http://servicemix.apache.org/schema/servicemix-mail-3.2.3.xsd
      http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";
    xmlns:util="http://www.springframework.org/schema/util";>

    <mail:poller
        service="mailsvc:mailPollerService"
        endpoint="pollerEndpoint"
        targetService="test:pipeline"
        period="60000"
        debugMode="false"
        deleteProcessedMessages="true"
        processOnlyUnseenMessages="false"
        connection="pop3://<ip>:<port>/INBOX?password=<xx>;user=<xx>">
    </mail:poller>

    <mail:sender
        service="mailsvc:mailSenderService"
        endpoint="senderEndpoint"
        sender="[email protected]"
        receiver="[email protected]"
        debugMode="false"
        connection="smtp://<mail adress>@<mail server ip>?password=<xx>"
    /mail:sender>
</beans>


*Eip-su xbean*
<?xml version="1.0" encoding="UTF-8"?>
<beans
    xmlns:eip="http://servicemix.apache.org/eip/1.0";
    xmlns:mailsvc="http://yourUrl";>

    <eip:pipeline service="test:pipeline" endpoint="endpoint">
        <eip:transformer>
            <eip:exchange-target service="mailsvc:fibonacciDroolService" />
        </eip:transformer>
        <eip:target>
            <eip:exchange-target service="mailsvc:mailSenderService" />
        </eip:target>
    </eip:pipeline>
</beans>


*drools-su xbean*
<?xml version="1.0" encoding="UTF-8"?>
<beans
    xmlns:drools="http://servicemix.apache.org/drools/1.0";
    xmlns:util="http://www.springframework.org/schema/util";
    xmlns:mailsvc="http://yourUrl";
    xmlns="http://www.springframework.org/schema/beans";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://servicemix.apache.org/drools/1.0
http://servicemix.apache.org/schema/servicemix-drools-3.3.1.xsd
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>



    <drools:endpoint service="mailsvc:fibonacciDroolService"
        endpoint="fibonacciDroolsEndpoint"
        ruleBaseResource="classpath:fibonacci.drl"
        globals="#globals" />

    <util:map id="globals">
        <entry key="helper" value-ref="helper" />
    </util:map>

    <bean id="helper" class="ar.com.osde.esb.test.drools.DroolsJbiHelper" />

</beans>




On Thu, Sep 3, 2009 at 7:45 PM, Zacarias <[email protected]> wrote:

> The parameter depends on what the targetService receive. The mail component
> just pass the message to it. I put "parameter" but you can name it what ever
> you want.
> My example has a  Mail poller which send the message to a Pipeline which
> redirect to a Drools endpoint. Drools endpoint espect a
> <parameter>xx</parameter>.
>
> If you use DefaultMarshaler you HAVE to put in the body of the mail an xml
> message, but this xml could be what ever you want.
> That why I got the reported error first because I'd put a plain text.
>
> Regards,
> Zaca
>
>
>
> On Thu, Sep 3, 2009 at 10:35 AM, Yang, Miles <[email protected]>wrote:
>
>>  Hello Zaca,
>>
>>
>>
>> I tried to test this change today, but it is not clear to me where to
>> apply the parameter. Is this the parameter for the default mail marshaller?
>> My example uses a mail poller only and it does not send mail.  I wait for
>> your example next week.
>>
>>
>>
>> Regards,
>>
>>
>>
>> Miles
>>
>>
>>  ------------------------------
>>
>> *From:* Zacarias [mailto:[email protected]]
>> *Sent:* September-02-09 2:06 PM
>> *To:* Yang, Miles
>> *Subject:* Re: Almost making (Mail to file)
>>
>>
>>
>> Good morning Miles,
>> when I send the mail I put
>> <parameter>5</parameter>
>>
>> So value 5 is taked as a parameter for a drools invocation.
>>
>> That's all. I didn't make another change besides the patch for the default
>> mail marshaller.
>>
>> I can send you the entire example next week because I'm in the Jboss
>> Summit right now.
>>
>> Regards,
>> Zaca
>>
>> On Wed, Sep 2, 2009 at 10:37 AM, <[email protected]> wrote:
>>
>> Good morning Zaca,
>>
>> I see your post online for the fix with the SA contains a email poller and
>> a file sender. You mentioned that you had made a work around, could you
>> share what is the workaround and where could I find it? I am trying to
>> create the same SA and enoutered the exact problem. One way I am trying to
>> solve the problem is by creating my own BinaryFileMarshaler, manual exact
>> the data from the normalized message again, as it is already done by the
>> DefaultMailMarshaler. It is not a very clean approach, but it may work. So I
>> am anxious to know your workaround.
>>
>>
>> Regards,
>>
>> Miles
>>
>>
>> Zaca wrote:
>> >
>> > Y made a workaround putting a XML in the mail body.
>> > It works fine.
>> > Then I got another error "NullPointerException"  in line 156 of
>> > DefaultMailMarshaler. This is because Multipart messages are always
>> > treated
>> > as Attachments.
>> > There is a bug in DefaultMailMarshaler where DataHandler referenced in
>> > line
>> > 157 I think is wrong.
>> > I made this patch. Plase feel free to do any comment.
>> > Regards
>> >
>> >
>> >
>>
>> > On Mon, Aug 10, 2009 at 4:38 PM, FuinhaAzul <[email protected]>
>> wrote:
>> >
>> >>
>> >> Gert, did you tried some example of receive mail message?
>> >>
>> >> If I read a file, then all works fine, but with mail component, that
>> >> message
>> >> "content not alowed in prolog" still shows.
>> >>
>> >> Any sugestion?
>> >>
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> Gert Vanthienen wrote:
>> >> >
>> >> > L.S.,
>> >> >
>> >> > I think the DefaultMailMarshaler might be trying to add the message
>> >> > content to the JBI MessageExchange as well.  Could you try enabling
>> >> > DEBUG logging and sending us the output from the logging, so we can
>> >> > find out where/when the exception occurs?  Also, could you paste us
>> >> > the full stack trace?  If my guess is correct, adding some XML
>> content
>> >> > to the message (provided it is a text/plain message) should be a
>> >> > workaround, but I'll give things a go here as well to see if I can
>> >> > reproduce this locally.
>> >> >
>> >> > Regards,
>> >> >
>> >> > Gert Vanthienen
>> >> > ------------------------
>> >> > Open Source SOA: http://fusesource.com
>> >> > Blog: http://gertvanthienen.blogspot.com/
>> >> >
>> >> >
>> >> >
>> >> > 2009/8/4 FuinhaAzul <[email protected]>:
>> >> >>
>> >> >> Hey guys!
>> >> >>
>> >> >> I´m still tring to receive the message and write de attachment to a
>> >> file
>> >> >> (the atachment is a xml), but: "The content is not allowed in
>> prolog".
>> >> >>
>> >> >> I tried DefaultFIleMarshaler and BinaryFileMarsaler, but the error
>> is
>> >> the
>> >> >> same.
>> >> >>
>> >> >> The email is succefuly received, but when I forward to file
>> endpoint,
>> >> >> then
>> >> >> the exception is throw.
>> >> >>
>> >> >> Any Ideas? (I think this is the last question to make this sample
>> >> work.)
>> >> >> http://www.nabble.com/file/p24801223/nl-mailtofile-sa.zip
>> >> >> nl-mailtofile-sa.zip
>> >> >>
>> >> >>
>> >> >> --
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/Almost-making-%28Mail-to-file%29-tp24801223p24801223.html
>> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> > -----
>> >> > ---
>> >> > Gert Vanthienen
>> >> > http://gertvanthienen.blogspot.com
>> >> >
>> >>
>> >> --
>> >> View this message in context:
>>
>> >>
>> http://www.nabble.com/Almost-making-%28Mail-to-file%29-tp24801223p24905919.html
>>
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>>
>> > Index:
>> >
>> bindings/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/DefaultMailMarshaler.java
>> > ===================================================================
>> > ---
>> >
>> bindings/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/DefaultMailMarshaler.java
>> > (revision 798962)
>> > +++
>> >
>> bindings/servicemix-mail/src/main/java/org/apache/servicemix/mail/marshaler/DefaultMailMarshaler.java
>> > (working copy)
>> > @@ -151,9 +151,10 @@
>> >                      // Create another body part
>> >                      messageBodyPart = new MimeBodyPart();
>> >                      // Set the data handler to the attachment
>> > -                    messageBodyPart.setDataHandler(new DataHandler(new
>> > FileDataSource(f)));
>> > +                    DataHandler fileDataHandler = new DataHandler(new
>> > FileDataSource(f));
>> > +                    messageBodyPart.setDataHandler(fileDataHandler);
>> >                      // Set the filename
>> > -
>> > messageBodyPart.setFileName(dh.getDataSource().getName());
>> > +
>> > messageBodyPart.setFileName(fileDataHandler.getDataSource().getName());
>> >                      // Set Disposition
>> >                      messageBodyPart.setDisposition(Part.ATTACHMENT);
>> >                      // Add part to multipart
>> >
>> >
>>
>> Quoted from:
>>
>> http://www.nabble.com/Almost-making-%28Mail-to-file%29-tp24801223p25029626.html
>>
>>
>>
>
>
<?xml version="1.0" encoding="UTF-8"?>
	<!--

		Licensed to the Apache Software Foundation (ASF) under one or more
		contributor license agreements. See the NOTICE file distributed with
		this work for additional information regarding copyright ownership.
		The ASF licenses this file to You under the Apache License, Version
		2.0 (the "License"); you may not use this file except in compliance
		with the License. You may obtain a copy of the License at

		http://www.apache.org/licenses/LICENSE-2.0 Unless required by
		applicable law or agreed to in writing, software distributed under the
		License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
		CONDITIONS OF ANY KIND, either express or implied. See the License for
		the specific language governing permissions and limitations under the
		License.
	-->

<beans xmlns:mail="http://servicemix.apache.org/mail/1.0";
	xmlns:mailsvc="http://yourUrl"; 
	xmlns="http://www.springframework.org/schema/beans";
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	xsi:schemaLocation="http://servicemix.apache.org/mail/1.0 http://servicemix.apache.org/schema/servicemix-mail-3.2.3.xsd
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";
	xmlns:util="http://www.springframework.org/schema/util";>

	<mail:poller
		service="mailsvc:mailPollerService"
		endpoint="pollerEndpoint"
		targetService="test:pipeline"
		period="60000" 
		debugMode="false"
		deleteProcessedMessages="true" 
		processOnlyUnseenMessages="false"
		connection="pop3://<ip>:<port>/INBOX?password=<xx>;user=<xx>">
	</mail:poller>

	<mail:sender 
		service="mailsvc:mailSenderService" 
		endpoint="senderEndpoint"
		sender="[email protected]" 
		receiver="[email protected]"
		debugMode="false" 
		connection="smtp://<mail adress>@<mail server ip>?password=<xx>" 
	/mail:sender>
</beans>

Reply via email to