RE: [Camel Mail Component] Caching MimeMultipart

2024-01-22 Thread Shenavai, Manuel
Hi everyone,

please let me know if you have any ideas on this topic.

Thank you &
Best regards,
Manuel

From: Shenavai, Manuel
Sent: 16 January 2024 08:47
To: users@camel.apache.org
Subject: [Camel Mail Component] Caching MimeMultipart

Hi everyone,

We are using the Camel Mail component to fetch mails from a mailbox. The camel 
exchange will provide the MimeMultipart Object in the exchange body.

We now see that every access to this MimeMulitpart will do a remote call to the 
mailserver. Is there any setting in camel that allows us to prevent this, i.e. 
by caching the data once it has been loaded?

Best regards,
Manuel

Example

Processor:
Each time getBody(String.class) is called, a remote calls to the mailserver are 
done.

public void process(Exchange exchange) throws Exception {
System.out.println("TEST 1.\n" + 
exchange.getMessage().getBody(String.class));
System.out.println("TEST 2.\n" + 
exchange.getMessage().getBody(String.class));
System.out.println("TEST 3.\n" + 
exchange.getMessage().getBody(String.class));
}

After running above lines with debugMode=true, I can see the remote calls:

A13 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A13 OK Success
A14 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A14 OK Success
TEST 1.
This is a mail body



A15 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A15 OK Success
A16 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A16 OK Success
TEST 2.
This is a mail body



A17 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A17 OK Success
A18 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A18 OK Success
TEST 3.
This is a mail body



[Camel Mail Component] Caching MimeMultipart

2024-01-15 Thread Shenavai, Manuel
Hi everyone,

We are using the Camel Mail component to fetch mails from a mailbox. The camel 
exchange will provide the MimeMultipart Object in the exchange body.

We now see that every access to this MimeMulitpart will do a remote call to the 
mailserver. Is there any setting in camel that allows us to prevent this, i.e. 
by caching the data once it has been loaded?

Best regards,
Manuel

Example

Processor:
Each time getBody(String.class) is called, a remote calls to the mailserver are 
done.

public void process(Exchange exchange) throws Exception {
System.out.println("TEST 1.\n" + 
exchange.getMessage().getBody(String.class));
System.out.println("TEST 2.\n" + 
exchange.getMessage().getBody(String.class));
System.out.println("TEST 3.\n" + 
exchange.getMessage().getBody(String.class));
}

After running above lines with debugMode=true, I can see the remote calls:

A13 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A13 OK Success
A14 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A14 OK Success
TEST 1.
This is a mail body



A15 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A15 OK Success
A16 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A16 OK Success
TEST 2.
This is a mail body



A17 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A17 OK Success
A18 FETCH 1 (BODY.PEEK[1.1])
* 1 FETCH (BODY[1.1] {30}
VGhpcyBpcyBhIG1haWwgYm9keQ0K
)
A18 OK Success
TEST 3.
This is a mail body



camel-mail problem : headers lost (more info, maybe bug ?)

2022-10-06 Thread Joël Guelluy

Hello,
One week ago, i previously tried the question here. Now i have more 
infos...


Sample code and explanations : 
https://stackoverflow.com/questions/73948864/camel-frommail-loose-headers


Short version :
Sample Route

from("imap://server?username=aaa=bbb=out=true=false=in=false")
 .setHeader("copyTo", simple("works"))
 .bean(MyTest.class, "hardcodeJson")
 .unmarshal(new JacksonDataFormat(Reply.class))
 .log("copyTo=${header[copyTo]}")

The problem : in console, i see in .log() that the content of the 
header[copyTo] is lost.

if i comment the .unmarshall(), it's OK
If i replace the from("imap") with a from('direct') in an unit test, 
it's OK.


Can someone explain me why ?
Is it a bug ?

Thanks in advance...


Re: camel-mail does not fetch attachments in Karaf.

2020-06-12 Thread Jean-Baptiste Onofre
Hi,

Sorry, I was busy with other topics. I will work on the sample later today.

Regards
JB

> Le 12 juin 2020 à 08:38, Kushal Gautam  a écrit :
> 
> Hi JB:
> 
> Sorry to bug you again. Any solutions or suggestions on this issue?
> 
> I tried a few other things as well, but I am pretty much stuck.
> 
> Thank you.
> 
> Regards,
> Kushal.
> 
> On Mon, Jun 8, 2020 at 2:18 PM Kushal Gautam 
> wrote:
> 
>> Hi JB:
>> 
>> Thanks.
>> 
>> I have already set up a sample project located at
>> https://github.com/cooshal/karaf-camel-mail
>> 
>> The project contains a custom karaf distribution (
>> https://github.com/cooshal/karaf-camel-mail/tree/master/asssembly/karaf-assembly
>> ).
>> 
>> My bundle is located at
>> https://github.com/cooshal/karaf-camel-mail/tree/master/components/imap-consumer
>> 
>> I am using Open JDK 8 for this project.
>> 
>> Kindly, please let me know if I should provide anything more.
>> 
>> Thank you again.
>> 
>> Regards,
>> Cooshal.
>> 
>> On Mon, Jun 8, 2020 at 2:11 PM Jean-Baptiste Onofre 
>> wrote:
>> 
>>> Sure, the easiest is probably to create a sample project. Do you already
>>> have one or do you want me to create one ?
>>> 
>>> Regards
>>> JB
>>> 
>>>> Le 8 juin 2020 à 13:46, Kushal Gautam  a
>>> écrit :
>>>> 
>>>> Hi JB:
>>>> 
>>>> Thank you for the pointers.
>>>> 
>>>> However, I do not know where and how exactly should I change the context
>>>> loader in my code.
>>>> 
>>>> I tried but I do not know where.
>>>> 
>>>> Could you please help me out?
>>>> 
>>>> Thank you.
>>>> 
>>>> Regards,
>>>> Cooshal.
>>>> 
>>>> On Mon, Jun 8, 2020 at 9:34 AM Jean-Baptiste Onofre 
>>> wrote:
>>>> 
>>>>> You can find some details about similar issue in the following thread:
>>>>> 
>>>>> 
>>>>> 
>>> http://karaf.922171.n3.nabble.com/java-mail-inside-Karaf-td4057507.html#a4057524
>>>>> <
>>>>> 
>>> http://karaf.922171.n3.nabble.com/java-mail-inside-Karaf-td4057507.html#a4057524
>>>>>> 
>>>>> 
>>>>> Let me know if it doesn’t help, I will fix your bundle for you.
>>>>> 
>>>>> Regards
>>>>> JB
>>>>> 
>>>>>> Le 7 juin 2020 à 10:50, Kushal Gautam  a
>>> écrit
>>>>> :
>>>>>> 
>>>>>> Hi again:
>>>>>> 
>>>>>> I have the following error when I try to start my bundle in karaf:
>>>>>> 
>>>>>> Ignoring converter type:
>>> org.apache.camel.converter.AttachmentConverter
>>>>> as
>>>>>> a dependent class could not be found: java.lang.NoClassDefFoundError:
>>>>>> javax/activation/DataHandler
>>>>>> java.lang.NoClassDefFoundError: javax/activation/DataHandler
>>>>>> at java.lang.Class.getDeclaredMethods0(Native Method) ~[?:?]
>>>>>> at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[?:?]
>>>>>> at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[?:?]
>>>>>> at
>>>>>> 
>>>>> 
>>> org.apache.camel.impl.converter.AnnotationTypeConverterLoader.loadConverterMethods(AnnotationTypeConverterLoader.java:262)
>>>>>> [62:org.apache.camel.camel-core:2.20.3]
>>>>>> at
>>>>>> 
>>>>> 
>>> org.apache.camel.impl.converter.AnnotationTypeConverterLoader.load(AnnotationTypeConverterLoader.java:130)
>>>>>> [62:org.apache.camel.camel-core:2.20.3]
>>>>>> at
>>>>>> 
>>>>> 
>>> org.apache.camel.impl.converter.BaseTypeConverterRegistry.loadCoreTypeConverters(BaseTypeConverterRegistry.java:632)
>>>>>> [62:org.apache.camel.camel-core:2.20.3]
>>>>>> at
>>>>>> 
>>>>> 
>>> org.apache.camel.core.osgi.OsgiTypeConverter.createRegistry(OsgiTypeConverter.java:218)
>>>>>> [60:org.apache.camel.camel-blueprint:2.20.3]
>>>>>> at
>>>>>> 
>>>>> 
>>> org.apache.camel.core.osgi.OsgiTypeConverter.getDelegate(OsgiTypeConverter.java:197)
>>>>>> [60:org.

Re: camel-mail does not fetch attachments in Karaf.

2020-06-12 Thread Kushal Gautam
Hi JB:

Sorry to bug you again. Any solutions or suggestions on this issue?

I tried a few other things as well, but I am pretty much stuck.

Thank you.

Regards,
Kushal.

On Mon, Jun 8, 2020 at 2:18 PM Kushal Gautam 
wrote:

> Hi JB:
>
> Thanks.
>
> I have already set up a sample project located at
> https://github.com/cooshal/karaf-camel-mail
>
> The project contains a custom karaf distribution (
> https://github.com/cooshal/karaf-camel-mail/tree/master/asssembly/karaf-assembly
> ).
>
> My bundle is located at
> https://github.com/cooshal/karaf-camel-mail/tree/master/components/imap-consumer
>
> I am using Open JDK 8 for this project.
>
> Kindly, please let me know if I should provide anything more.
>
> Thank you again.
>
> Regards,
> Cooshal.
>
> On Mon, Jun 8, 2020 at 2:11 PM Jean-Baptiste Onofre 
> wrote:
>
>> Sure, the easiest is probably to create a sample project. Do you already
>> have one or do you want me to create one ?
>>
>> Regards
>> JB
>>
>> > Le 8 juin 2020 à 13:46, Kushal Gautam  a
>> écrit :
>> >
>> > Hi JB:
>> >
>> > Thank you for the pointers.
>> >
>> > However, I do not know where and how exactly should I change the context
>> > loader in my code.
>> >
>> > I tried but I do not know where.
>> >
>> > Could you please help me out?
>> >
>> > Thank you.
>> >
>> > Regards,
>> > Cooshal.
>> >
>> > On Mon, Jun 8, 2020 at 9:34 AM Jean-Baptiste Onofre 
>> wrote:
>> >
>> >> You can find some details about similar issue in the following thread:
>> >>
>> >>
>> >>
>> http://karaf.922171.n3.nabble.com/java-mail-inside-Karaf-td4057507.html#a4057524
>> >> <
>> >>
>> http://karaf.922171.n3.nabble.com/java-mail-inside-Karaf-td4057507.html#a4057524
>> >>>
>> >>
>> >> Let me know if it doesn’t help, I will fix your bundle for you.
>> >>
>> >> Regards
>> >> JB
>> >>
>> >>> Le 7 juin 2020 à 10:50, Kushal Gautam  a
>> écrit
>> >> :
>> >>>
>> >>> Hi again:
>> >>>
>> >>> I have the following error when I try to start my bundle in karaf:
>> >>>
>> >>> Ignoring converter type:
>> org.apache.camel.converter.AttachmentConverter
>> >> as
>> >>> a dependent class could not be found: java.lang.NoClassDefFoundError:
>> >>> javax/activation/DataHandler
>> >>> java.lang.NoClassDefFoundError: javax/activation/DataHandler
>> >>> at java.lang.Class.getDeclaredMethods0(Native Method) ~[?:?]
>> >>> at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[?:?]
>> >>> at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[?:?]
>> >>> at
>> >>>
>> >>
>> org.apache.camel.impl.converter.AnnotationTypeConverterLoader.loadConverterMethods(AnnotationTypeConverterLoader.java:262)
>> >>> [62:org.apache.camel.camel-core:2.20.3]
>> >>> at
>> >>>
>> >>
>> org.apache.camel.impl.converter.AnnotationTypeConverterLoader.load(AnnotationTypeConverterLoader.java:130)
>> >>> [62:org.apache.camel.camel-core:2.20.3]
>> >>> at
>> >>>
>> >>
>> org.apache.camel.impl.converter.BaseTypeConverterRegistry.loadCoreTypeConverters(BaseTypeConverterRegistry.java:632)
>> >>> [62:org.apache.camel.camel-core:2.20.3]
>> >>> at
>> >>>
>> >>
>> org.apache.camel.core.osgi.OsgiTypeConverter.createRegistry(OsgiTypeConverter.java:218)
>> >>> [60:org.apache.camel.camel-blueprint:2.20.3]
>> >>> at
>> >>>
>> >>
>> org.apache.camel.core.osgi.OsgiTypeConverter.getDelegate(OsgiTypeConverter.java:197)
>> >>> [60:org.apache.camel.camel-blueprint:2.20.3]
>> >>> at
>> >>>
>> >>
>> org.apache.camel.core.osgi.OsgiTypeConverter.mandatoryConvertTo(OsgiTypeConverter.java:124)
>> >>> [60:org.apache.camel.camel-blueprint:2.20.3]
>> >>> at
>> >>>
>> >>
>> org.apache.camel.impl.CamelPostProcessorHelper.getInjectionPropertyValue(CamelPostProcessorHelper.java:278)
>> >>> [62:org.apache.camel.camel-core:2.20.3]
>> >>> at
>> >>>
>> >>
>>

Re: camel-mail does not fetch attachments in Karaf.

2020-06-08 Thread Kushal Gautam
Hi JB:

Thanks.

I have already set up a sample project located at
https://github.com/cooshal/karaf-camel-mail

The project contains a custom karaf distribution (
https://github.com/cooshal/karaf-camel-mail/tree/master/asssembly/karaf-assembly
).

My bundle is located at
https://github.com/cooshal/karaf-camel-mail/tree/master/components/imap-consumer

I am using Open JDK 8 for this project.

Kindly, please let me know if I should provide anything more.

Thank you again.

Regards,
Cooshal.

On Mon, Jun 8, 2020 at 2:11 PM Jean-Baptiste Onofre  wrote:

> Sure, the easiest is probably to create a sample project. Do you already
> have one or do you want me to create one ?
>
> Regards
> JB
>
> > Le 8 juin 2020 à 13:46, Kushal Gautam  a écrit
> :
> >
> > Hi JB:
> >
> > Thank you for the pointers.
> >
> > However, I do not know where and how exactly should I change the context
> > loader in my code.
> >
> > I tried but I do not know where.
> >
> > Could you please help me out?
> >
> > Thank you.
> >
> > Regards,
> > Cooshal.
> >
> > On Mon, Jun 8, 2020 at 9:34 AM Jean-Baptiste Onofre 
> wrote:
> >
> >> You can find some details about similar issue in the following thread:
> >>
> >>
> >>
> http://karaf.922171.n3.nabble.com/java-mail-inside-Karaf-td4057507.html#a4057524
> >> <
> >>
> http://karaf.922171.n3.nabble.com/java-mail-inside-Karaf-td4057507.html#a4057524
> >>>
> >>
> >> Let me know if it doesn’t help, I will fix your bundle for you.
> >>
> >> Regards
> >> JB
> >>
> >>> Le 7 juin 2020 à 10:50, Kushal Gautam  a
> écrit
> >> :
> >>>
> >>> Hi again:
> >>>
> >>> I have the following error when I try to start my bundle in karaf:
> >>>
> >>> Ignoring converter type: org.apache.camel.converter.AttachmentConverter
> >> as
> >>> a dependent class could not be found: java.lang.NoClassDefFoundError:
> >>> javax/activation/DataHandler
> >>> java.lang.NoClassDefFoundError: javax/activation/DataHandler
> >>> at java.lang.Class.getDeclaredMethods0(Native Method) ~[?:?]
> >>> at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[?:?]
> >>> at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[?:?]
> >>> at
> >>>
> >>
> org.apache.camel.impl.converter.AnnotationTypeConverterLoader.loadConverterMethods(AnnotationTypeConverterLoader.java:262)
> >>> [62:org.apache.camel.camel-core:2.20.3]
> >>> at
> >>>
> >>
> org.apache.camel.impl.converter.AnnotationTypeConverterLoader.load(AnnotationTypeConverterLoader.java:130)
> >>> [62:org.apache.camel.camel-core:2.20.3]
> >>> at
> >>>
> >>
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.loadCoreTypeConverters(BaseTypeConverterRegistry.java:632)
> >>> [62:org.apache.camel.camel-core:2.20.3]
> >>> at
> >>>
> >>
> org.apache.camel.core.osgi.OsgiTypeConverter.createRegistry(OsgiTypeConverter.java:218)
> >>> [60:org.apache.camel.camel-blueprint:2.20.3]
> >>> at
> >>>
> >>
> org.apache.camel.core.osgi.OsgiTypeConverter.getDelegate(OsgiTypeConverter.java:197)
> >>> [60:org.apache.camel.camel-blueprint:2.20.3]
> >>> at
> >>>
> >>
> org.apache.camel.core.osgi.OsgiTypeConverter.mandatoryConvertTo(OsgiTypeConverter.java:124)
> >>> [60:org.apache.camel.camel-blueprint:2.20.3]
> >>> at
> >>>
> >>
> org.apache.camel.impl.CamelPostProcessorHelper.getInjectionPropertyValue(CamelPostProcessorHelper.java:278)
> >>> [62:org.apache.camel.camel-core:2.20.3]
> >>> at
> >>>
> >>
> org.apache.camel.impl.DefaultCamelBeanPostProcessor.injectFieldProperty(DefaultCamelBeanPostProcessor.java:211)
> >>> [62:org.apache.camel.camel-core:2.20.3]
> >>> at
> >>>
> >>
> org.apache.camel.impl.DefaultCamelBeanPostProcessor$1.doWith(DefaultCamelBeanPostProcessor.java:171)
> >>> [62:org.apache.camel.camel-core:2.20.3]
> >>> at
> >>>
> >>
> org.apache.camel.util.ReflectionHelper.doWithFields(ReflectionHelper.java:74)
> >>> [62:org.apache.camel.camel-core:2.20.3]
> >>> at
> >>>
> >>
> org.apache.camel.impl.DefaultCamelBeanPostProcessor.injectFields(DefaultCamelBe

Re: camel-mail does not fetch attachments in Karaf.

2020-06-08 Thread Jean-Baptiste Onofre
ked.customizerModified(BundleHookBundleTracker.java:433)
>>> [43:org.apache.aries.blueprint.core:1.9.0]
>>> at
>>> 
>> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)
>>> [43:org.apache.aries.blueprint.core:1.9.0]
>>> at
>>> 
>> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)
>>> [43:org.apache.aries.blueprint.core:1.9.0]
>>> at
>>> 
>> org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)
>>> [43:org.apache.aries.blueprint.core:1.9.0]
>>> at
>>> 
>> org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1179)
>>> [?:?]
>>> at
>>> 
>> org.apache.felix.framework.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:730)
>>> [?:?]
>>> at
>>> 
>> org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:485)
>>> [?:?]
>>> at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579)
>> [?:?]
>>> at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) [?:?]
>>> at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) [?:?]
>>> at
>>> 
>> org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260)
>>> [7:org.apache.felix.fileinstall:3.6.4]
>>> at
>>> 
>> org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233)
>>> [7:org.apache.felix.fileinstall:3.6.4]
>>> at
>>> 
>> org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221)
>>> [7:org.apache.felix.fileinstall:3.6.4]
>>> at
>>> 
>> org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515)
>>> [7:org.apache.felix.fileinstall:3.6.4]
>>> at
>>> 
>> org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
>>> [7:org.apache.felix.fileinstall:3.6.4]
>>> at
>>> 
>> org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
>>> [7:org.apache.felix.fileinstall:3.6.4]
>>> Caused by: java.lang.ClassNotFoundException: javax.activation.DataHandler
>>> not found by org.apache.camel.camel-core [62]
>>> at
>>> 
>> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1639)
>>> ~[?:?]
>>> at
>>> 
>> org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
>>> ~[?:?]
>>> at
>>> 
>> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
>>> ~[?:?]
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:352) ~[?:?]
>>> 
>>> Just to test out, I also tried including javax.activation in the
>>> dependencies
>>> 
>>> 
>>>   javax.activation
>>>   activation
>>>   1.1
>>>   
>>> 
>>> and embedding it in the bundle
>>> 
>>> 
>>>   
>>>   
>>>   org.apache.felix
>>>   maven-bundle-plugin
>>>   true
>>>   
>>>   
>>>   activation
>>>   
>>>   *;resolution:=optional
>>>   
>>>   
>>>   
>>>   
>>>   
>>>   
>>> 
>>> but, either ways, it does not work.
>>> 
>>> Have I misconfigured anything wrong, in this case?
>>> 
>>> Any inputs/pointers would be very helpful.
>>> 
>>> 
>>> Thank you.
>>> 
>>> Regards,
>>> Cooshal.
>>> 
>>> On Thu, Jun 4, 2020 at 3:05 PM Jean-Baptiste Onofre 
>> wrote:
>>> 
>>>> Hi,
>>>> 
>>>> How are you looking for the attachment ? In the class loader resource or
>>>> using path ?
>>>> 
>>>> I guess your attachement files are not found (either because it’s not
>>>> private package of your bundle, or not imported correctly).
>>>> 
>>>> Regards
>>>> JB
>>>> 
>>>>> Le 4 juin 2020 à 15:03, Kushal Gautam  a
>> écrit
>>>> :
>>>>> 
>>>>> Camel Version: 2.20.3
>>>>> Java: Open JDK 1.8.0_242
>>>>> Karaf: 4.2.0
>>>>> 
>>>>> Hi:
>>>>> 
>>>>> Currently, I am using camel-mail to fetch mails via IMAP.
>>>>> 
>>>>> The route is pretty simple and looks like:
>>>>> 
>>>>> from("imaps://{{IMAP_SERVER_URL}}"
>>>>>  + "?username={{IMAP_EMAIL_USER}}"
>>>>>  + "={{IMAP_EMAIL_PASS}}"
>>>>>  + "=true"
>>>>>  + "=false"
>>>>>  + "=100"
>>>>>  + "={{IMAP_POLL_DURATION}}")
>>>>> .
>>>>> 
>>>>> My custom processor looks something like below (most of the stuffs
>> taken
>>>>> from the attachments example):
>>>>> 
>>>>> ...
>>>>> @Override
>>>>>  public void process(Exchange exchange) throws Exception {
>>>>> 
>>>>>  exchange.getIn().setHeader("HAS_ATTACHMENTS", false);
>>>>> 
>>>>>  Map attachments =
>>>>> exchange.getIn().getAttachments();
>>>>> 
>>>>>  if (attachments.size() > 0) {
>>>>>  for (String name : attachments.keySet()) {
>>>>>  DataHandler dh = attachments.get(name);
>>>>>  // get the file name
>>>>>  String filename = dh.getName();
>>>>> 
>>>>>  System.out.println(filename);
>>>>> 
>>>>>  // check if the attachment is an xml file
>>>>>  // if not continue to another attachment
>>>>>  if(!filename.endsWith(".xml")) {
>>>>>  continue;
>>>>>  }
>>>>> 
>>>>>  System.out.println("email has an xml attachment");
>>>>> 
>>>>>  // get the content and convert it to byte[]
>>>>>  byte[] data = exchange
>>>>>  .getContext()
>>>>>  .getTypeConverter()
>>>>>  .convertTo(byte[].class, dh.getInputStream());
>>>>> 
>>>>>  exchange.getIn().setHeader("FILE_NAME", filename);
>>>>>  exchange.getIn().setHeader("HAS_ATTACHMENTS", true);
>>>>> 
>>>>>  exchange.getIn().setBody(data);
>>>>>  break;
>>>>>  }
>>>>>  }
>>>>> ...
>>>>> 
>>>>> If I send an email with some attachments, this code works perfectly
>> fine
>>>>> when I execute it via Netbeans. But, attachments.size() returns 0 for
>> the
>>>>> same code and same email inside Karaf.
>>>>> 
>>>>> Do I need to configure something specific for this?
>>>>> 
>>>>> Any inputs on this would be helpful.
>>>>> 
>>>>> Thanks,
>>>>> Cooshal.
>>>> 
>>>> 
>> 
>> 



Re: camel-mail does not fetch attachments in Karaf.

2020-06-08 Thread Kushal Gautam
.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:485)
> > [?:?]
> > at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4579)
> [?:?]
> > at org.apache.felix.framework.Felix.startBundle(Felix.java:2174) [?:?]
> > at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998) [?:?]
> > at
> >
> org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260)
> > [7:org.apache.felix.fileinstall:3.6.4]
> > at
> >
> org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233)
> > [7:org.apache.felix.fileinstall:3.6.4]
> > at
> >
> org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221)
> > [7:org.apache.felix.fileinstall:3.6.4]
> > at
> >
> org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515)
> > [7:org.apache.felix.fileinstall:3.6.4]
> > at
> >
> org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365)
> > [7:org.apache.felix.fileinstall:3.6.4]
> > at
> >
> org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316)
> > [7:org.apache.felix.fileinstall:3.6.4]
> > Caused by: java.lang.ClassNotFoundException: javax.activation.DataHandler
> > not found by org.apache.camel.camel-core [62]
> > at
> >
> org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1639)
> > ~[?:?]
> > at
> >
> org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
> > ~[?:?]
> > at
> >
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
> > ~[?:?]
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:352) ~[?:?]
> >
> > Just to test out, I also tried including javax.activation in the
> > dependencies
> >
> > 
> >javax.activation
> >activation
> >1.1
> >
> >
> > and embedding it in the bundle
> >
> > 
> >
> >
> >org.apache.felix
> >maven-bundle-plugin
> >true
> >
> >
> >activation
> >
> >*;resolution:=optional
> >
> >
> >
> >
> >
> >
> >
> > but, either ways, it does not work.
> >
> > Have I misconfigured anything wrong, in this case?
> >
> > Any inputs/pointers would be very helpful.
> >
> >
> > Thank you.
> >
> > Regards,
> > Cooshal.
> >
> > On Thu, Jun 4, 2020 at 3:05 PM Jean-Baptiste Onofre 
> wrote:
> >
> >> Hi,
> >>
> >> How are you looking for the attachment ? In the class loader resource or
> >> using path ?
> >>
> >> I guess your attachement files are not found (either because it’s not
> >> private package of your bundle, or not imported correctly).
> >>
> >> Regards
> >> JB
> >>
> >>> Le 4 juin 2020 à 15:03, Kushal Gautam  a
> écrit
> >> :
> >>>
> >>> Camel Version: 2.20.3
> >>> Java: Open JDK 1.8.0_242
> >>> Karaf: 4.2.0
> >>>
> >>> Hi:
> >>>
> >>> Currently, I am using camel-mail to fetch mails via IMAP.
> >>>
> >>> The route is pretty simple and looks like:
> >>>
> >>> from("imaps://{{IMAP_SERVER_URL}}"
> >>>   + "?username={{IMAP_EMAIL_USER}}"
> >>>   + "={{IMAP_EMAIL_PASS}}"
> >>>   + "=true"
> >>>   + "=false"
> >>>   + "=100"
> >>>   + "={{IMAP_POLL_DURATION}}")
> >>> .
> >>>
> >>> My custom processor looks something like below (most of the stuffs
> taken
> >>> from the attachments example):
> >>>
> >>> ...
> >>> @Override
> >>>   public void process(Exchange exchange) throws Exception {
> >>>
> >>>   exchange.getIn().setHeader("HAS_ATTACHMENTS", false);
> >>>
> >>>   Map attachments =
> >>> exchange.getIn().getAttachments();
> >>>
> >>>   if (attachments.size() > 0) {
> >>>   for (String name : attachments.keySet()) {
> >>>   DataHandler dh = attachments.get(name);
> >>>   // get the file name
> >>>   String filename = dh.getName();
> >>>
> >>>   System.out.println(filename);
> >>>
> >>>   // check if the attachment is an xml file
> >>>   // if not continue to another attachment
> >>>   if(!filename.endsWith(".xml")) {
> >>>   continue;
> >>>   }
> >>>
> >>>   System.out.println("email has an xml attachment");
> >>>
> >>>   // get the content and convert it to byte[]
> >>>   byte[] data = exchange
> >>>   .getContext()
> >>>   .getTypeConverter()
> >>>   .convertTo(byte[].class, dh.getInputStream());
> >>>
> >>>   exchange.getIn().setHeader("FILE_NAME", filename);
> >>>   exchange.getIn().setHeader("HAS_ATTACHMENTS", true);
> >>>
> >>>   exchange.getIn().setBody(data);
> >>>   break;
> >>>   }
> >>>   }
> >>> ...
> >>>
> >>> If I send an email with some attachments, this code works perfectly
> fine
> >>> when I execute it via Netbeans. But, attachments.size() returns 0 for
> the
> >>> same code and same email inside Karaf.
> >>>
> >>> Do I need to configure something specific for this?
> >>>
> >>> Any inputs on this would be helpful.
> >>>
> >>> Thanks,
> >>> Cooshal.
> >>
> >>
>
>


Re: camel-mail does not fetch attachments in Karaf.

2020-06-08 Thread Jean-Baptiste Onofre
ework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1639)
> ~[?:?]
> at
> org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
> ~[?:?]
> at
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
> ~[?:?]
> at java.lang.ClassLoader.loadClass(ClassLoader.java:352) ~[?:?]
> 
> Just to test out, I also tried including javax.activation in the
> dependencies
> 
> 
>javax.activation
>activation
>1.1
>
> 
> and embedding it in the bundle
> 
> 
>
>
>org.apache.felix
>maven-bundle-plugin
>true
>
>
>activation
>
>*;resolution:=optional
>
>
>
>
>
>
> 
> but, either ways, it does not work.
> 
> Have I misconfigured anything wrong, in this case?
> 
> Any inputs/pointers would be very helpful.
> 
> 
> Thank you.
> 
> Regards,
> Cooshal.
> 
> On Thu, Jun 4, 2020 at 3:05 PM Jean-Baptiste Onofre  wrote:
> 
>> Hi,
>> 
>> How are you looking for the attachment ? In the class loader resource or
>> using path ?
>> 
>> I guess your attachement files are not found (either because it’s not
>> private package of your bundle, or not imported correctly).
>> 
>> Regards
>> JB
>> 
>>> Le 4 juin 2020 à 15:03, Kushal Gautam  a écrit
>> :
>>> 
>>> Camel Version: 2.20.3
>>> Java: Open JDK 1.8.0_242
>>> Karaf: 4.2.0
>>> 
>>> Hi:
>>> 
>>> Currently, I am using camel-mail to fetch mails via IMAP.
>>> 
>>> The route is pretty simple and looks like:
>>> 
>>> from("imaps://{{IMAP_SERVER_URL}}"
>>>   + "?username={{IMAP_EMAIL_USER}}"
>>>   + "={{IMAP_EMAIL_PASS}}"
>>>   + "=true"
>>>   + "=false"
>>>   + "=100"
>>>   + "={{IMAP_POLL_DURATION}}")
>>> .
>>> 
>>> My custom processor looks something like below (most of the stuffs taken
>>> from the attachments example):
>>> 
>>> ...
>>> @Override
>>>   public void process(Exchange exchange) throws Exception {
>>> 
>>>   exchange.getIn().setHeader("HAS_ATTACHMENTS", false);
>>> 
>>>   Map attachments =
>>> exchange.getIn().getAttachments();
>>> 
>>>   if (attachments.size() > 0) {
>>>   for (String name : attachments.keySet()) {
>>>   DataHandler dh = attachments.get(name);
>>>   // get the file name
>>>   String filename = dh.getName();
>>> 
>>>   System.out.println(filename);
>>> 
>>>   // check if the attachment is an xml file
>>>   // if not continue to another attachment
>>>   if(!filename.endsWith(".xml")) {
>>>   continue;
>>>   }
>>> 
>>>   System.out.println("email has an xml attachment");
>>> 
>>>   // get the content and convert it to byte[]
>>>   byte[] data = exchange
>>>   .getContext()
>>>   .getTypeConverter()
>>>   .convertTo(byte[].class, dh.getInputStream());
>>> 
>>>   exchange.getIn().setHeader("FILE_NAME", filename);
>>>   exchange.getIn().setHeader("HAS_ATTACHMENTS", true);
>>> 
>>>   exchange.getIn().setBody(data);
>>>   break;
>>>   }
>>>   }
>>> ...
>>> 
>>> If I send an email with some attachments, this code works perfectly fine
>>> when I execute it via Netbeans. But, attachments.size() returns 0 for the
>>> same code and same email inside Karaf.
>>> 
>>> Do I need to configure something specific for this?
>>> 
>>> Any inputs on this would be helpful.
>>> 
>>> Thanks,
>>> Cooshal.
>> 
>> 



Re: camel-mail does not fetch attachments in Karaf.

2020-06-08 Thread Kushal Gautam
Hello JB:

Thank you for getting back.

I tried that out in frustration ;)

Don’t embed activation in your bundle. You have the spec provided.
>

I am using Open JDK 1.8.0_242

Are you using JDK 8 or 11+ ?
>

To clarify and reproduce this issue, I have created a project in github. I
am using a custom karaf distribution. The bundle and karaf distribution are
included in this project.

The route and transformers are located at
https://github.com/cooshal/karaf-camel-mail/tree/master/components/imap-consumer/src/main/java/com/krigosoft/eai/imap/consumer/routing

Thank you.

Regards,
Cooshal.

On Mon, Jun 8, 2020 at 6:32 AM Jean-Baptiste Onofre  wrote:

> Hi,
>
> Don’t embed activation in your bundle. You have the spec provided. Are you
> using JDK 8 or 11+ ?
>
> Regards
> JB
>
> > Le 7 juin 2020 à 10:50, Kushal Gautam  a écrit
> :
> >
> > Hi again:
> >
> > I have the following error when I try to start my bundle in karaf:
> >
> > Ignoring converter type: org.apache.camel.converter.AttachmentConverter
> as
> > a dependent class could not be found: java.lang.NoClassDefFoundError:
> > javax/activation/DataHandler
> > java.lang.NoClassDefFoundError: javax/activation/DataHandler
> > at java.lang.Class.getDeclaredMethods0(Native Method) ~[?:?]
> > at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[?:?]
> > at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[?:?]
> > at
> >
> org.apache.camel.impl.converter.AnnotationTypeConverterLoader.loadConverterMethods(AnnotationTypeConverterLoader.java:262)
> > [62:org.apache.camel.camel-core:2.20.3]
> > at
> >
> org.apache.camel.impl.converter.AnnotationTypeConverterLoader.load(AnnotationTypeConverterLoader.java:130)
> > [62:org.apache.camel.camel-core:2.20.3]
> > at
> >
> org.apache.camel.impl.converter.BaseTypeConverterRegistry.loadCoreTypeConverters(BaseTypeConverterRegistry.java:632)
> > [62:org.apache.camel.camel-core:2.20.3]
> > at
> >
> org.apache.camel.core.osgi.OsgiTypeConverter.createRegistry(OsgiTypeConverter.java:218)
> > [60:org.apache.camel.camel-blueprint:2.20.3]
> > at
> >
> org.apache.camel.core.osgi.OsgiTypeConverter.getDelegate(OsgiTypeConverter.java:197)
> > [60:org.apache.camel.camel-blueprint:2.20.3]
> > at
> >
> org.apache.camel.core.osgi.OsgiTypeConverter.mandatoryConvertTo(OsgiTypeConverter.java:124)
> > [60:org.apache.camel.camel-blueprint:2.20.3]
> > at
> >
> org.apache.camel.impl.CamelPostProcessorHelper.getInjectionPropertyValue(CamelPostProcessorHelper.java:278)
> > [62:org.apache.camel.camel-core:2.20.3]
> > at
> >
> org.apache.camel.impl.DefaultCamelBeanPostProcessor.injectFieldProperty(DefaultCamelBeanPostProcessor.java:211)
> > [62:org.apache.camel.camel-core:2.20.3]
> > at
> >
> org.apache.camel.impl.DefaultCamelBeanPostProcessor$1.doWith(DefaultCamelBeanPostProcessor.java:171)
> > [62:org.apache.camel.camel-core:2.20.3]
> > at
> >
> org.apache.camel.util.ReflectionHelper.doWithFields(ReflectionHelper.java:74)
> > [62:org.apache.camel.camel-core:2.20.3]
> > at
> >
> org.apache.camel.impl.DefaultCamelBeanPostProcessor.injectFields(DefaultCamelBeanPostProcessor.java:167)
> > [62:org.apache.camel.camel-core:2.20.3]
> > at
> >
> org.apache.camel.impl.DefaultCamelBeanPostProcessor.postProcessBeforeInitialization(DefaultCamelBeanPostProcessor.java:82)
> > [62:org.apache.camel.camel-core:2.20.3]
> > at
> >
> org.apache.camel.impl.DefaultInjector.newInstance(DefaultInjector.java:48)
> > [62:org.apache.camel.camel-core:2.20.3]
> > at
> >
> org.apache.camel.blueprint.PackageScanRouteBuilderFinder.instantiateBuilder(PackageScanRouteBuilderFinder.java:110)
> > [60:org.apache.camel.camel-blueprint:2.20.3]
> > at
> >
> org.apache.camel.blueprint.PackageScanRouteBuilderFinder.appendBuilders(PackageScanRouteBuilderFinder.java:72)
> > [60:org.apache.camel.camel-blueprint:2.20.3]
> > at
> >
> org.apache.camel.blueprint.CamelContextFactoryBean.findRouteBuildersByPackageScan(CamelContextFactoryBean.java:325)
> > [60:org.apache.camel.camel-blueprint:2.20.3]
> > at
> >
> org.apache.camel.core.xml.AbstractCamelContextFactoryBean.findRouteBuilders(AbstractCamelContextFactoryBean.java:1087)
> > [60:org.apache.camel.camel-blueprint:2.20.3]
> > at
> >
> org.apache.camel.core.xml.AbstractCamelContextFactoryBean.setupRoutes(AbstractCamelContextFactoryBean.java:450)
> > [60:org.apache.camel.camel-blueprint:2.20.3]
> > at
> >
> org.apache.camel.blueprint.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.java:355)
> > [60:org.apache.

Re: camel-mail does not fetch attachments in Karaf.

2020-06-07 Thread Jean-Baptiste Onofre
gImpl.access$200(BundleWiringImpl.java:80)
> ~[?:?]
> at
> org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053)
> ~[?:?]
> at java.lang.ClassLoader.loadClass(ClassLoader.java:352) ~[?:?]
> 
> Just to test out, I also tried including javax.activation in the
> dependencies
> 
> 
>javax.activation
>activation
>1.1
>
> 
> and embedding it in the bundle
> 
> 
>
>
>org.apache.felix
>maven-bundle-plugin
>true
>
>
>activation
>
>*;resolution:=optional
>
>
>
>
>
>
> 
> but, either ways, it does not work.
> 
> Have I misconfigured anything wrong, in this case?
> 
> Any inputs/pointers would be very helpful.
> 
> 
> Thank you.
> 
> Regards,
> Cooshal.
> 
> On Thu, Jun 4, 2020 at 3:05 PM Jean-Baptiste Onofre  wrote:
> 
>> Hi,
>> 
>> How are you looking for the attachment ? In the class loader resource or
>> using path ?
>> 
>> I guess your attachement files are not found (either because it’s not
>> private package of your bundle, or not imported correctly).
>> 
>> Regards
>> JB
>> 
>>> Le 4 juin 2020 à 15:03, Kushal Gautam  a écrit
>> :
>>> 
>>> Camel Version: 2.20.3
>>> Java: Open JDK 1.8.0_242
>>> Karaf: 4.2.0
>>> 
>>> Hi:
>>> 
>>> Currently, I am using camel-mail to fetch mails via IMAP.
>>> 
>>> The route is pretty simple and looks like:
>>> 
>>> from("imaps://{{IMAP_SERVER_URL}}"
>>>   + "?username={{IMAP_EMAIL_USER}}"
>>>   + "={{IMAP_EMAIL_PASS}}"
>>>   + "=true"
>>>   + "=false"
>>>   + "=100"
>>>   + "={{IMAP_POLL_DURATION}}")
>>> .
>>> 
>>> My custom processor looks something like below (most of the stuffs taken
>>> from the attachments example):
>>> 
>>> ...
>>> @Override
>>>   public void process(Exchange exchange) throws Exception {
>>> 
>>>   exchange.getIn().setHeader("HAS_ATTACHMENTS", false);
>>> 
>>>   Map attachments =
>>> exchange.getIn().getAttachments();
>>> 
>>>   if (attachments.size() > 0) {
>>>   for (String name : attachments.keySet()) {
>>>   DataHandler dh = attachments.get(name);
>>>   // get the file name
>>>   String filename = dh.getName();
>>> 
>>>   System.out.println(filename);
>>> 
>>>   // check if the attachment is an xml file
>>>   // if not continue to another attachment
>>>   if(!filename.endsWith(".xml")) {
>>>   continue;
>>>   }
>>> 
>>>   System.out.println("email has an xml attachment");
>>> 
>>>   // get the content and convert it to byte[]
>>>   byte[] data = exchange
>>>   .getContext()
>>>   .getTypeConverter()
>>>   .convertTo(byte[].class, dh.getInputStream());
>>> 
>>>   exchange.getIn().setHeader("FILE_NAME", filename);
>>>   exchange.getIn().setHeader("HAS_ATTACHMENTS", true);
>>> 
>>>   exchange.getIn().setBody(data);
>>>   break;
>>>   }
>>>   }
>>> ...
>>> 
>>> If I send an email with some attachments, this code works perfectly fine
>>> when I execute it via Netbeans. But, attachments.size() returns 0 for the
>>> same code and same email inside Karaf.
>>> 
>>> Do I need to configure something specific for this?
>>> 
>>> Any inputs on this would be helpful.
>>> 
>>> Thanks,
>>> Cooshal.
>> 
>> 



Re: camel-mail does not fetch attachments in Karaf.

2020-06-07 Thread Kushal Gautam
ither because it’s not
> private package of your bundle, or not imported correctly).
>
> Regards
> JB
>
> > Le 4 juin 2020 à 15:03, Kushal Gautam  a écrit
> :
> >
> > Camel Version: 2.20.3
> > Java: Open JDK 1.8.0_242
> > Karaf: 4.2.0
> >
> > Hi:
> >
> > Currently, I am using camel-mail to fetch mails via IMAP.
> >
> > The route is pretty simple and looks like:
> >
> > from("imaps://{{IMAP_SERVER_URL}}"
> >+ "?username={{IMAP_EMAIL_USER}}"
> >+ "={{IMAP_EMAIL_PASS}}"
> >+ "=true"
> >+ "=false"
> >+ "=100"
> >+ "={{IMAP_POLL_DURATION}}")
> > .
> >
> > My custom processor looks something like below (most of the stuffs taken
> > from the attachments example):
> >
> > ...
> > @Override
> >public void process(Exchange exchange) throws Exception {
> >
> >exchange.getIn().setHeader("HAS_ATTACHMENTS", false);
> >
> >Map attachments =
> > exchange.getIn().getAttachments();
> >
> >if (attachments.size() > 0) {
> >for (String name : attachments.keySet()) {
> >DataHandler dh = attachments.get(name);
> >// get the file name
> >String filename = dh.getName();
> >
> >System.out.println(filename);
> >
> >// check if the attachment is an xml file
> >// if not continue to another attachment
> >if(!filename.endsWith(".xml")) {
> >continue;
> >}
> >
> >System.out.println("email has an xml attachment");
> >
> >// get the content and convert it to byte[]
> >byte[] data = exchange
> >.getContext()
> >.getTypeConverter()
> >.convertTo(byte[].class, dh.getInputStream());
> >
> >exchange.getIn().setHeader("FILE_NAME", filename);
> >exchange.getIn().setHeader("HAS_ATTACHMENTS", true);
> >
> >exchange.getIn().setBody(data);
> >break;
> >}
> >}
> > ...
> >
> > If I send an email with some attachments, this code works perfectly fine
> > when I execute it via Netbeans. But, attachments.size() returns 0 for the
> > same code and same email inside Karaf.
> >
> > Do I need to configure something specific for this?
> >
> > Any inputs on this would be helpful.
> >
> > Thanks,
> > Cooshal.
>
>


Re: camel-mail does not fetch attachments in Karaf.

2020-06-04 Thread Kushal Gautam
Hi JB:

I am not exactly sure about the internals.

https://camel.apache.org/components/latest/others/attachments.html

>From the point of view of my code, it is:

...
Map attachments = exchange.getIn().getAttachments();
...
for (String name : attachments.keySet()) {
DataHandler dh = attachments.get(name);
// get the file name
String filename = dh.getName();

...
}

which basically gets the javax.activation.DataHandler instance of the
attachment

Do you know which particular package I need to import?

In my bundle, I had the following configuration as well


org.apache.felix
maven-bundle-plugin
true



javax.activation;version=1.1,
*;resolution:=optional





But, this also doesn't seem to help either.

Thank you.

Regards,
Cooshal.

On Thu, Jun 4, 2020 at 3:05 PM Jean-Baptiste Onofre  wrote:

> Hi,
>
> How are you looking for the attachment ? In the class loader resource or
> using path ?
>
> I guess your attachement files are not found (either because it’s not
> private package of your bundle, or not imported correctly).
>
> Regards
> JB
>
> > Le 4 juin 2020 à 15:03, Kushal Gautam  a écrit
> :
> >
> > Camel Version: 2.20.3
> > Java: Open JDK 1.8.0_242
> > Karaf: 4.2.0
> >
> > Hi:
> >
> > Currently, I am using camel-mail to fetch mails via IMAP.
> >
> > The route is pretty simple and looks like:
> >
> > from("imaps://{{IMAP_SERVER_URL}}"
> >+ "?username={{IMAP_EMAIL_USER}}"
> >+ "={{IMAP_EMAIL_PASS}}"
> >+ "=true"
> >+ "=false"
> >+ "=100"
> >+ "={{IMAP_POLL_DURATION}}")
> > .
> >
> > My custom processor looks something like below (most of the stuffs taken
> > from the attachments example):
> >
> > ...
> > @Override
> >public void process(Exchange exchange) throws Exception {
> >
> >exchange.getIn().setHeader("HAS_ATTACHMENTS", false);
> >
> >Map attachments =
> > exchange.getIn().getAttachments();
> >
> >if (attachments.size() > 0) {
> >for (String name : attachments.keySet()) {
> >DataHandler dh = attachments.get(name);
> >// get the file name
> >String filename = dh.getName();
> >
> >System.out.println(filename);
> >
> >// check if the attachment is an xml file
> >// if not continue to another attachment
> >if(!filename.endsWith(".xml")) {
> >continue;
> >}
> >
> >System.out.println("email has an xml attachment");
> >
> >// get the content and convert it to byte[]
> >byte[] data = exchange
> >.getContext()
> >.getTypeConverter()
> >.convertTo(byte[].class, dh.getInputStream());
> >
> >exchange.getIn().setHeader("FILE_NAME", filename);
> >exchange.getIn().setHeader("HAS_ATTACHMENTS", true);
> >
> >exchange.getIn().setBody(data);
> >break;
> >}
> >}
> > ...
> >
> > If I send an email with some attachments, this code works perfectly fine
> > when I execute it via Netbeans. But, attachments.size() returns 0 for the
> > same code and same email inside Karaf.
> >
> > Do I need to configure something specific for this?
> >
> > Any inputs on this would be helpful.
> >
> > Thanks,
> > Cooshal.
>
>


Re: camel-mail does not fetch attachments in Karaf.

2020-06-04 Thread Jean-Baptiste Onofre
Hi,

How are you looking for the attachment ? In the class loader resource or using 
path ?

I guess your attachement files are not found (either because it’s not private 
package of your bundle, or not imported correctly).

Regards
JB

> Le 4 juin 2020 à 15:03, Kushal Gautam  a écrit :
> 
> Camel Version: 2.20.3
> Java: Open JDK 1.8.0_242
> Karaf: 4.2.0
> 
> Hi:
> 
> Currently, I am using camel-mail to fetch mails via IMAP.
> 
> The route is pretty simple and looks like:
> 
> from("imaps://{{IMAP_SERVER_URL}}"
>+ "?username={{IMAP_EMAIL_USER}}"
>+ "={{IMAP_EMAIL_PASS}}"
>+ "=true"
>+ "=false"
>+ "=100"
>+ "={{IMAP_POLL_DURATION}}")
> .
> 
> My custom processor looks something like below (most of the stuffs taken
> from the attachments example):
> 
> ...
> @Override
>public void process(Exchange exchange) throws Exception {
> 
>exchange.getIn().setHeader("HAS_ATTACHMENTS", false);
> 
>Map attachments =
> exchange.getIn().getAttachments();
> 
>if (attachments.size() > 0) {
>for (String name : attachments.keySet()) {
>DataHandler dh = attachments.get(name);
>// get the file name
>String filename = dh.getName();
> 
>System.out.println(filename);
> 
>// check if the attachment is an xml file
>// if not continue to another attachment
>if(!filename.endsWith(".xml")) {
>continue;
>}
> 
>System.out.println("email has an xml attachment");
> 
>// get the content and convert it to byte[]
>byte[] data = exchange
>.getContext()
>.getTypeConverter()
>.convertTo(byte[].class, dh.getInputStream());
> 
>exchange.getIn().setHeader("FILE_NAME", filename);
>exchange.getIn().setHeader("HAS_ATTACHMENTS", true);
> 
>exchange.getIn().setBody(data);
>break;
>}
>}
> ...
> 
> If I send an email with some attachments, this code works perfectly fine
> when I execute it via Netbeans. But, attachments.size() returns 0 for the
> same code and same email inside Karaf.
> 
> Do I need to configure something specific for this?
> 
> Any inputs on this would be helpful.
> 
> Thanks,
> Cooshal.



camel-mail does not fetch attachments in Karaf.

2020-06-04 Thread Kushal Gautam
Camel Version: 2.20.3
Java: Open JDK 1.8.0_242
Karaf: 4.2.0

Hi:

Currently, I am using camel-mail to fetch mails via IMAP.

The route is pretty simple and looks like:

from("imaps://{{IMAP_SERVER_URL}}"
+ "?username={{IMAP_EMAIL_USER}}"
+ "={{IMAP_EMAIL_PASS}}"
+ "=true"
+ "=false"
+ "=100"
+ "={{IMAP_POLL_DURATION}}")
.

My custom processor looks something like below (most of the stuffs taken
from the attachments example):

...
@Override
public void process(Exchange exchange) throws Exception {

exchange.getIn().setHeader("HAS_ATTACHMENTS", false);

Map attachments =
exchange.getIn().getAttachments();

if (attachments.size() > 0) {
for (String name : attachments.keySet()) {
DataHandler dh = attachments.get(name);
// get the file name
String filename = dh.getName();

System.out.println(filename);

// check if the attachment is an xml file
// if not continue to another attachment
if(!filename.endsWith(".xml")) {
continue;
}

System.out.println("email has an xml attachment");

// get the content and convert it to byte[]
byte[] data = exchange
.getContext()
.getTypeConverter()
.convertTo(byte[].class, dh.getInputStream());

exchange.getIn().setHeader("FILE_NAME", filename);
exchange.getIn().setHeader("HAS_ATTACHMENTS", true);

exchange.getIn().setBody(data);
break;
}
}
...

If I send an email with some attachments, this code works perfectly fine
when I execute it via Netbeans. But, attachments.size() returns 0 for the
same code and same email inside Karaf.

Do I need to configure something specific for this?

Any inputs on this would be helpful.

Thanks,
Cooshal.


Re: Camel Mail issue

2019-01-15 Thread Claus Ibsen
Hi

There is a FAQ about this at
http://camel.apache.org/how-do-i-configure-password-options-on-camel-endpoints-without-the-value-being-encoded.html

On Tue, Jan 15, 2019 at 2:17 PM Riggy Software
 wrote:
>
> Hi,
>
> I'm not sure who to inform about this, but I've just had a bit of a nightmare 
> figuring out where connection problem lied using Camel Mail. I had an Amazon 
> password that had + symbols in it and it turns out that they were getting 
> stripped out by Camel's StringHelper class when getting the properties.
>
> BUT there IS a way to avoid this fortunately.
> "RAW(value)" which avoids processing the value.
> I really think this would be useful to put in the documentation. I've never 
> seen it mentioned, and it's a very important feature.
>
> Regards,
> Naseem
>
>
> Get Outlook for Android<https://aka.ms/ghei36>
>


-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Camel Mail issue

2019-01-15 Thread Riggy Software
Okay okay, I found it in the endpoint docs page.
Sorry. But it's the last place I looked (with Google) and only after I knew 
what to search for.

Regards,
Naseem

Get Outlook for Android<https://aka.ms/ghei36>


From: Riggy Software 
Sent: Tuesday, January 15, 2019 1:17:18 PM
To: users@camel.apache.org
Subject: Camel Mail issue

Hi,

I'm not sure who to inform about this, but I've just had a bit of a nightmare 
figuring out where connection problem lied using Camel Mail. I had an Amazon 
password that had + symbols in it and it turns out that they were getting 
stripped out by Camel's StringHelper class when getting the properties.

BUT there IS a way to avoid this fortunately.
"RAW(value)" which avoids processing the value.
I really think this would be useful to put in the documentation. I've never 
seen it mentioned, and it's a very important feature.

Regards,
Naseem


Get Outlook for Android<https://aka.ms/ghei36>



Camel Mail issue

2019-01-15 Thread Riggy Software
Hi,

I'm not sure who to inform about this, but I've just had a bit of a nightmare 
figuring out where connection problem lied using Camel Mail. I had an Amazon 
password that had + symbols in it and it turns out that they were getting 
stripped out by Camel's StringHelper class when getting the properties.

BUT there IS a way to avoid this fortunately.
"RAW(value)" which avoids processing the value.
I really think this would be useful to put in the documentation. I've never 
seen it mentioned, and it's a very important feature.

Regards,
Naseem


Get Outlook for Android<https://aka.ms/ghei36>



Re: camel-mail validation process

2018-09-19 Thread Marco Pampaloni
Unfortunately, it does not work

Il giorno mar 18 set 2018 alle ore 16:41 Claus Ibsen 
ha scritto:

> Hi
>
> You can try to turn of peek with peek=false
> On Mon, Sep 17, 2018 at 4:12 PM Marco Pampaloni
>  wrote:
> >
> > Hi everyone, I've been trying to write down a camel route that listens
> to a
> > mailbox and downloads the messages when needed... The problem is that the
> > server contains about 5k mails and it looks like a sort of validation
> > process takes place before the fetch.
> >  It takes a really long time to complete (probably evaluating 1-2 mail
> per
> > second). Is this really necessary? Is there a way to disable this
> behaviour?
> >
> > I tried setting fetchSize and maxMessagesPerPoll to low values, but after
> > inspecting the code on github, it turned out that they both get used
> after
> > this "validation process". You can check this out here:
> >
> https://github.com/apache/camel/blob/master/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java
> >
> > At the end of the retrieveMessages method you can see a loop that scans
> the
> > retrieved messages, which is genetaring the previously described
> behaviour.
> >
> > Can anybody help?
> >
> > --
> > Marco Pampaloni
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


-- 
Marco Pampaloni


Re: camel-mail validation process

2018-09-18 Thread Claus Ibsen
Hi

You can try to turn of peek with peek=false
On Mon, Sep 17, 2018 at 4:12 PM Marco Pampaloni
 wrote:
>
> Hi everyone, I've been trying to write down a camel route that listens to a
> mailbox and downloads the messages when needed... The problem is that the
> server contains about 5k mails and it looks like a sort of validation
> process takes place before the fetch.
>  It takes a really long time to complete (probably evaluating 1-2 mail per
> second). Is this really necessary? Is there a way to disable this behaviour?
>
> I tried setting fetchSize and maxMessagesPerPoll to low values, but after
> inspecting the code on github, it turned out that they both get used after
> this "validation process". You can check this out here:
> https://github.com/apache/camel/blob/master/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java
>
> At the end of the retrieveMessages method you can see a loop that scans the
> retrieved messages, which is genetaring the previously described behaviour.
>
> Can anybody help?
>
> --
> Marco Pampaloni



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


camel-mail validation process

2018-09-17 Thread Marco Pampaloni
Hi everyone, I've been trying to write down a camel route that listens to a
mailbox and downloads the messages when needed... The problem is that the
server contains about 5k mails and it looks like a sort of validation
process takes place before the fetch.
 It takes a really long time to complete (probably evaluating 1-2 mail per
second). Is this really necessary? Is there a way to disable this behaviour?

I tried setting fetchSize and maxMessagesPerPoll to low values, but after
inspecting the code on github, it turned out that they both get used after
this "validation process". You can check this out here:
https://github.com/apache/camel/blob/master/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java

At the end of the retrieveMessages method you can see a loop that scans the
retrieved messages, which is genetaring the previously described behaviour.

Can anybody help?

-- 
Marco Pampaloni


Re: Type converter misbehavior with camel-cxf and camel-mail

2018-06-18 Thread Claus Ibsen
Hi

Ah darn we can try to look into avoiding that type converter in
camel-mail - we can potentially do the conversion manually.
You are welcome to log a JIRA ticket.



On Tue, Jun 12, 2018 at 9:25 PM, Bagwell, Allen F
 wrote:
> I'm trying to integrate a CXF REST client into my camel route that already 
> has a SMTP endpoint incorporated into it via camel-mail. (This is using Camel 
> 2.18.5)
>
> When the client is invoked (this is configured via a blueprint), the 
> CxfRsProducer class in camel-cxf has the resource class loaded that I have 
> defined and using the proxy (CxfConstants.CAMEL_CXF_RS_USING_HTTP_API = 
> false, CxfConstants.OPERATION_NAME = "putStatus") it successfully looks up 
> the method the client needs, which in this case will use the String body of 
> the in-message to set as a parameter.
>
> This is where it gets weird. The CxfRsProducer needs to find a converter to 
> take the String body and turn it into an Object[]. In every other case where 
> I've done this, it finds the appropriate type converter and life is good.  
> However when camel-mail is present in the classpath the converter search 
> method picks:
>
> com.sun.mail.imap.SortTerm[] 
> org.apache.camel.component.mail.MailConverters.toSortTerm(String msg)
>
> This converter fails to produce the desired result and then a list of 
> fallback converters are tried. None of these work either and so the final 
> decision is to not use the in-message body but rather the in-message object 
> itself (DefaultMessage).  This of course isn't the correct solution, so the 
> whole CxfRsProducer bombs on a NoSuchMethodException because it can't find 
> the correct type parameter (String) that my resource class method needs.
>
> If I remove camel-mail, the CXF client works exactly as expected because it 
> finds the right String -> Object[] converter.
>
> I have never really had to muck around explicitly with converters before, but 
> is there a way to get these two dependencies to cooperate and pick the 
> correct converter? My current workaround is in my preparation of the exchange 
> just before the rest client is invoked I put the String I need to send into 
> an Object[] and set that as the new in-message body. Seems a bit of a kluge, 
> but it allows me to continue.
>
> Thanks!
> -Allen



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Type converter misbehavior with camel-cxf and camel-mail

2018-06-14 Thread Willem Jiang
Camel uses the traditional Java SPI loading mechanism.
camel-core just loads the type converters by looking up the type convert
file from the class path.
It cannot tell which one is prioritized unless we add an order number into
the converter, but the number cannot be changed by user.


Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Fri, Jun 15, 2018 at 12:25 AM, Bagwell, Allen F <
afba...@sandia.gov.invalid> wrote:

> I would have never known I needed a String -> Object[] converter for the
> body unless I stepped through the CfxRsProducer code with a debugger.
> Therefore I’m not sure that handing some kind of control/override mechanism
> to the developer via a configuration would not have helped me.
>
> Fundamentally, this seems to be an issue where the camel component in
> question needs to be able to prioritize its own type converters first.
> Camel-cxf has the classes in the package: org.apache.camel.component.
> cxf.converter
>
> and camel-mail has the class org.apache.camel.component.
> mail.MailConverters
>
> Is there any way to tell the Type Converter search code to prioritize a
> component’s own converters first?
>
> -Allen
>
> From: Willem.Jiang [via Camel] [mailto:ml+s465427n5820564...@n5.nabble.com
> ]
> Sent: Wednesday, June 13, 2018 2:30 AM
> To: Bagwell, Allen F 
> Subject: [EXTERNAL] Re: Type converter misbehavior with camel-cxf and
> camel-mail
>
> Hi Bagwell,
>
> Thank you for share your experience of using the camel type converter.
>
> Most time the embedded type converter just work as it is designed, but we
> cannot guarantee it works in different combinations.
> as we don't provide the override mechanism which could introduce some
> trouble for user to resolve the type convert conflict.
> Maybe we could introduce some option in the application context to give
> user a chance to get back control of which converter can work.
>
> The first thing came into my mind is configuration file which ship with the
> application to decide the order of the type converter.
> But I'm not sure if it can work across all the deployment that camel
> supports.
>
> any thought?
>
>
> Willem Jiang
>
> Twitter: willemjiang
> Weibo: 姜宁willem
>
> On Wed, Jun 13, 2018 at 3:25 AM, Bagwell, Allen F <
> [hidden email]> wrote:
>
> > I'm trying to integrate a CXF REST client into my camel route that
> already
> > has a SMTP endpoint incorporated into it via camel-mail. (This is using
> > Camel 2.18.5)
> >
> > When the client is invoked (this is configured via a blueprint), the
> > CxfRsProducer class in camel-cxf has the resource class loaded that I
> have
> > defined and using the proxy (CxfConstants.CAMEL_CXF_RS_USING_HTTP_API =
> > false, CxfConstants.OPERATION_NAME = "putStatus") it successfully looks
> up
> > the method the client needs, which in this case will use the String body
> of
> > the in-message to set as a parameter.
> >
> > This is where it gets weird. The CxfRsProducer needs to find a converter
> > to take the String body and turn it into an Object[]. In every other case
> > where I've done this, it finds the appropriate type converter and life is
> > good.  However when camel-mail is present in the classpath the converter
> > search method picks:
> >
> > com.sun.mail.imap.SortTerm[] org.apache.camel.component.
> > mail.MailConverters.toSortTerm(String msg)
> >
> > This converter fails to produce the desired result and then a list of
> > fallback converters are tried. None of these work either and so the final
> > decision is to not use the in-message body but rather the in-message
> object
> > itself (DefaultMessage).  This of course isn't the correct solution, so
> the
> > whole CxfRsProducer bombs on a NoSuchMethodException because it can't
> find
> > the correct type parameter (String) that my resource class method needs.
> >
> > If I remove camel-mail, the CXF client works exactly as expected because
> > it finds the right String -> Object[] converter.
> >
> > I have never really had to muck around explicitly with converters before,
> > but is there a way to get these two dependencies to cooperate and pick
> the
> > correct converter? My current workaround is in my preparation of the
> > exchange just before the rest client is invoked I put the String I need
> to
> > send into an Object[] and set that as the new in-message body. Seems a
> bit
> > of a kluge, but it allows me to continue.
> >
> > Thanks!
> > -Allen
> >
>
> 
> If you reply to this email, your message will be added to th

Re: Type converter misbehavior with camel-cxf and camel-mail

2018-06-14 Thread Bagwell, Allen F

In my preparation step, I was doing this as the last bit in my processor prior 
to invoking the client:

inMessage.setBody(status, String.class);

I also tried inserting an explicit conversion into the blueprint right before 
the client invocation:



Neither approach worked. I still got the CxfRsProducer throwing a 
NoSuchMethodException.

-Allen


From: Quinn Stevenson [via Camel] [mailto:ml+s465427n5820565...@n5.nabble.com]
Sent: Wednesday, June 13, 2018 5:59 AM
To: Bagwell, Allen F 
Subject: [EXTERNAL] Re: Type converter misbehavior with camel-cxf and camel-mail

Not sure if this is an option, but can you insert a call to a bean (or 
processor) before the CXF call that does the body conversion the way you want?

> On Jun 13, 2018, at 3:30 AM, Willem Jiang <[hidden 
> email]> wrote:
>
> Hi Bagwell,
>
> Thank you for share your experience of using the camel type converter.
>
> Most time the embedded type converter just work as it is designed, but we
> cannot guarantee it works in different combinations.
> as we don't provide the override mechanism which could introduce some
> trouble for user to resolve the type convert conflict.
> Maybe we could introduce some option in the application context to give
> user a chance to get back control of which converter can work.
>
> The first thing came into my mind is configuration file which ship with the
> application to decide the order of the type converter.
> But I'm not sure if it can work across all the deployment that camel
> supports.
>
> any thought?
>
>
> Willem Jiang
>
> Twitter: willemjiang
> Weibo: 姜宁willem
>
> On Wed, Jun 13, 2018 at 3:25 AM, Bagwell, Allen F <
> [hidden email]> wrote:
>
>> I'm trying to integrate a CXF REST client into my camel route that already
>> has a SMTP endpoint incorporated into it via camel-mail. (This is using
>> Camel 2.18.5)
>>
>> When the client is invoked (this is configured via a blueprint), the
>> CxfRsProducer class in camel-cxf has the resource class loaded that I have
>> defined and using the proxy (CxfConstants.CAMEL_CXF_RS_USING_HTTP_API =
>> false, CxfConstants.OPERATION_NAME = "putStatus") it successfully looks up
>> the method the client needs, which in this case will use the String body of
>> the in-message to set as a parameter.
>>
>> This is where it gets weird. The CxfRsProducer needs to find a converter
>> to take the String body and turn it into an Object[]. In every other case
>> where I've done this, it finds the appropriate type converter and life is
>> good.  However when camel-mail is present in the classpath the converter
>> search method picks:
>>
>> com.sun.mail.imap.SortTerm[] org.apache.camel.component.
>> mail.MailConverters.toSortTerm(String msg)
>>
>> This converter fails to produce the desired result and then a list of
>> fallback converters are tried. None of these work either and so the final
>> decision is to not use the in-message body but rather the in-message object
>> itself (DefaultMessage).  This of course isn't the correct solution, so the
>> whole CxfRsProducer bombs on a NoSuchMethodException because it can't find
>> the correct type parameter (String) that my resource class method needs.
>>
>> If I remove camel-mail, the CXF client works exactly as expected because
>> it finds the right String -> Object[] converter.
>>
>> I have never really had to muck around explicitly with converters before,
>> but is there a way to get these two dependencies to cooperate and pick the
>> correct converter? My current workaround is in my preparation of the
>> exchange just before the rest client is invoked I put the String I need to
>> send into an Object[] and set that as the new in-message body. Seems a bit
>> of a kluge, but it allows me to continue.
>>
>> Thanks!
>> -Allen
>>


If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/Type-converter-misbehavior-with-camel-cxf-and-camel-mail-tp5820546p5820565.html
To unsubscribe from Camel - Users, click 
here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code=465428=YWZiYWd3ZUBzYW5kaWEuZ292fDQ2NTQyOHwtNDQyMTA1NTgz>.
NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer=instant_html%21nabble%3Aemail.naml=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>


Re: Type converter misbehavior with camel-cxf and camel-mail

2018-06-14 Thread Bagwell, Allen F
I would have never known I needed a String -> Object[] converter for the body 
unless I stepped through the CfxRsProducer code with a debugger. Therefore I’m 
not sure that handing some kind of control/override mechanism to the developer 
via a configuration would not have helped me.

Fundamentally, this seems to be an issue where the camel component in question 
needs to be able to prioritize its own type converters first.  Camel-cxf has 
the classes in the package: org.apache.camel.component.cxf.converter

and camel-mail has the class org.apache.camel.component.mail.MailConverters

Is there any way to tell the Type Converter search code to prioritize a 
component’s own converters first?

-Allen

From: Willem.Jiang [via Camel] [mailto:ml+s465427n5820564...@n5.nabble.com]
Sent: Wednesday, June 13, 2018 2:30 AM
To: Bagwell, Allen F 
Subject: [EXTERNAL] Re: Type converter misbehavior with camel-cxf and camel-mail

Hi Bagwell,

Thank you for share your experience of using the camel type converter.

Most time the embedded type converter just work as it is designed, but we
cannot guarantee it works in different combinations.
as we don't provide the override mechanism which could introduce some
trouble for user to resolve the type convert conflict.
Maybe we could introduce some option in the application context to give
user a chance to get back control of which converter can work.

The first thing came into my mind is configuration file which ship with the
application to decide the order of the type converter.
But I'm not sure if it can work across all the deployment that camel
supports.

any thought?


Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Wed, Jun 13, 2018 at 3:25 AM, Bagwell, Allen F <
[hidden email]> wrote:

> I'm trying to integrate a CXF REST client into my camel route that already
> has a SMTP endpoint incorporated into it via camel-mail. (This is using
> Camel 2.18.5)
>
> When the client is invoked (this is configured via a blueprint), the
> CxfRsProducer class in camel-cxf has the resource class loaded that I have
> defined and using the proxy (CxfConstants.CAMEL_CXF_RS_USING_HTTP_API =
> false, CxfConstants.OPERATION_NAME = "putStatus") it successfully looks up
> the method the client needs, which in this case will use the String body of
> the in-message to set as a parameter.
>
> This is where it gets weird. The CxfRsProducer needs to find a converter
> to take the String body and turn it into an Object[]. In every other case
> where I've done this, it finds the appropriate type converter and life is
> good.  However when camel-mail is present in the classpath the converter
> search method picks:
>
> com.sun.mail.imap.SortTerm[] org.apache.camel.component.
> mail.MailConverters.toSortTerm(String msg)
>
> This converter fails to produce the desired result and then a list of
> fallback converters are tried. None of these work either and so the final
> decision is to not use the in-message body but rather the in-message object
> itself (DefaultMessage).  This of course isn't the correct solution, so the
> whole CxfRsProducer bombs on a NoSuchMethodException because it can't find
> the correct type parameter (String) that my resource class method needs.
>
> If I remove camel-mail, the CXF client works exactly as expected because
> it finds the right String -> Object[] converter.
>
> I have never really had to muck around explicitly with converters before,
> but is there a way to get these two dependencies to cooperate and pick the
> correct converter? My current workaround is in my preparation of the
> exchange just before the rest client is invoked I put the String I need to
> send into an Object[] and set that as the new in-message body. Seems a bit
> of a kluge, but it allows me to continue.
>
> Thanks!
> -Allen
>


If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/Type-converter-misbehavior-with-camel-cxf-and-camel-mail-tp5820546p5820564.html
To unsubscribe from Camel - Users, click 
here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code=465428=YWZiYWd3ZUBzYW5kaWEuZ292fDQ2NTQyOHwtNDQyMTA1NTgz>.
NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer=instant_html%21nabble%3Aemail.naml=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>


Re: Type converter misbehavior with camel-cxf and camel-mail

2018-06-13 Thread Quinn Stevenson
Not sure if this is an option, but can you insert a call to a bean (or 
processor) before the CXF call that does the body conversion the way you want?

> On Jun 13, 2018, at 3:30 AM, Willem Jiang  wrote:
> 
> Hi Bagwell,
> 
> Thank you for share your experience of using the camel type converter.
> 
> Most time the embedded type converter just work as it is designed, but we
> cannot guarantee it works in different combinations.
> as we don't provide the override mechanism which could introduce some
> trouble for user to resolve the type convert conflict.
> Maybe we could introduce some option in the application context to give
> user a chance to get back control of which converter can work.
> 
> The first thing came into my mind is configuration file which ship with the
> application to decide the order of the type converter.
> But I'm not sure if it can work across all the deployment that camel
> supports.
> 
> any thought?
> 
> 
> Willem Jiang
> 
> Twitter: willemjiang
> Weibo: 姜宁willem
> 
> On Wed, Jun 13, 2018 at 3:25 AM, Bagwell, Allen F <
> afba...@sandia.gov.invalid> wrote:
> 
>> I'm trying to integrate a CXF REST client into my camel route that already
>> has a SMTP endpoint incorporated into it via camel-mail. (This is using
>> Camel 2.18.5)
>> 
>> When the client is invoked (this is configured via a blueprint), the
>> CxfRsProducer class in camel-cxf has the resource class loaded that I have
>> defined and using the proxy (CxfConstants.CAMEL_CXF_RS_USING_HTTP_API =
>> false, CxfConstants.OPERATION_NAME = "putStatus") it successfully looks up
>> the method the client needs, which in this case will use the String body of
>> the in-message to set as a parameter.
>> 
>> This is where it gets weird. The CxfRsProducer needs to find a converter
>> to take the String body and turn it into an Object[]. In every other case
>> where I've done this, it finds the appropriate type converter and life is
>> good.  However when camel-mail is present in the classpath the converter
>> search method picks:
>> 
>> com.sun.mail.imap.SortTerm[] org.apache.camel.component.
>> mail.MailConverters.toSortTerm(String msg)
>> 
>> This converter fails to produce the desired result and then a list of
>> fallback converters are tried. None of these work either and so the final
>> decision is to not use the in-message body but rather the in-message object
>> itself (DefaultMessage).  This of course isn't the correct solution, so the
>> whole CxfRsProducer bombs on a NoSuchMethodException because it can't find
>> the correct type parameter (String) that my resource class method needs.
>> 
>> If I remove camel-mail, the CXF client works exactly as expected because
>> it finds the right String -> Object[] converter.
>> 
>> I have never really had to muck around explicitly with converters before,
>> but is there a way to get these two dependencies to cooperate and pick the
>> correct converter? My current workaround is in my preparation of the
>> exchange just before the rest client is invoked I put the String I need to
>> send into an Object[] and set that as the new in-message body. Seems a bit
>> of a kluge, but it allows me to continue.
>> 
>> Thanks!
>> -Allen
>> 



Re: Type converter misbehavior with camel-cxf and camel-mail

2018-06-13 Thread Willem Jiang
Hi Bagwell,

Thank you for share your experience of using the camel type converter.

Most time the embedded type converter just work as it is designed, but we
cannot guarantee it works in different combinations.
as we don't provide the override mechanism which could introduce some
trouble for user to resolve the type convert conflict.
Maybe we could introduce some option in the application context to give
user a chance to get back control of which converter can work.

The first thing came into my mind is configuration file which ship with the
application to decide the order of the type converter.
But I'm not sure if it can work across all the deployment that camel
supports.

any thought?


Willem Jiang

Twitter: willemjiang
Weibo: 姜宁willem

On Wed, Jun 13, 2018 at 3:25 AM, Bagwell, Allen F <
afba...@sandia.gov.invalid> wrote:

> I'm trying to integrate a CXF REST client into my camel route that already
> has a SMTP endpoint incorporated into it via camel-mail. (This is using
> Camel 2.18.5)
>
> When the client is invoked (this is configured via a blueprint), the
> CxfRsProducer class in camel-cxf has the resource class loaded that I have
> defined and using the proxy (CxfConstants.CAMEL_CXF_RS_USING_HTTP_API =
> false, CxfConstants.OPERATION_NAME = "putStatus") it successfully looks up
> the method the client needs, which in this case will use the String body of
> the in-message to set as a parameter.
>
> This is where it gets weird. The CxfRsProducer needs to find a converter
> to take the String body and turn it into an Object[]. In every other case
> where I've done this, it finds the appropriate type converter and life is
> good.  However when camel-mail is present in the classpath the converter
> search method picks:
>
> com.sun.mail.imap.SortTerm[] org.apache.camel.component.
> mail.MailConverters.toSortTerm(String msg)
>
> This converter fails to produce the desired result and then a list of
> fallback converters are tried. None of these work either and so the final
> decision is to not use the in-message body but rather the in-message object
> itself (DefaultMessage).  This of course isn't the correct solution, so the
> whole CxfRsProducer bombs on a NoSuchMethodException because it can't find
> the correct type parameter (String) that my resource class method needs.
>
> If I remove camel-mail, the CXF client works exactly as expected because
> it finds the right String -> Object[] converter.
>
> I have never really had to muck around explicitly with converters before,
> but is there a way to get these two dependencies to cooperate and pick the
> correct converter? My current workaround is in my preparation of the
> exchange just before the rest client is invoked I put the String I need to
> send into an Object[] and set that as the new in-message body. Seems a bit
> of a kluge, but it allows me to continue.
>
> Thanks!
> -Allen
>


Type converter misbehavior with camel-cxf and camel-mail

2018-06-12 Thread Bagwell, Allen F
I'm trying to integrate a CXF REST client into my camel route that already has 
a SMTP endpoint incorporated into it via camel-mail. (This is using Camel 
2.18.5)

When the client is invoked (this is configured via a blueprint), the 
CxfRsProducer class in camel-cxf has the resource class loaded that I have 
defined and using the proxy (CxfConstants.CAMEL_CXF_RS_USING_HTTP_API = false, 
CxfConstants.OPERATION_NAME = "putStatus") it successfully looks up the method 
the client needs, which in this case will use the String body of the in-message 
to set as a parameter.

This is where it gets weird. The CxfRsProducer needs to find a converter to 
take the String body and turn it into an Object[]. In every other case where 
I've done this, it finds the appropriate type converter and life is good.  
However when camel-mail is present in the classpath the converter search method 
picks:

com.sun.mail.imap.SortTerm[] 
org.apache.camel.component.mail.MailConverters.toSortTerm(String msg)

This converter fails to produce the desired result and then a list of fallback 
converters are tried. None of these work either and so the final decision is to 
not use the in-message body but rather the in-message object itself 
(DefaultMessage).  This of course isn't the correct solution, so the whole 
CxfRsProducer bombs on a NoSuchMethodException because it can't find the 
correct type parameter (String) that my resource class method needs.

If I remove camel-mail, the CXF client works exactly as expected because it 
finds the right String -> Object[] converter.

I have never really had to muck around explicitly with converters before, but 
is there a way to get these two dependencies to cooperate and pick the correct 
converter? My current workaround is in my preparation of the exchange just 
before the rest client is invoked I put the String I need to send into an 
Object[] and set that as the new in-message body. Seems a bit of a kluge, but 
it allows me to continue.

Thanks!
-Allen


Re: Camel Mail: MaxMessagesPerPoll vs fetchSize

2018-06-11 Thread Claus Ibsen
The max is a generic option that batch components inherit. Its
limiting after messages has been downloaded/consumed.
The fetch is a component specific option, eg mail protocol, to limit
on the mail server side.

Favour using fetch when possible, eg component specific options.


On Mon, Jun 11, 2018 at 2:09 PM, Shenavai, Manuel
 wrote:
> Hi everyone,
>
>
>
> I got a question regarding the Camel Mail Component parameters
> maxMessagesPerPoll and fetchSize. Reading the documentation, the parameters
> sound quite similar. Both seem to restrict the number of messages processed
> per poll. MaxMessagePerPoll seem to control the amount of messages that are
> downloaded, while fetchSize specifies the number of messages consumed per
> poll.
>
>
>
> For me this sounds very similar. Can someone help to better understand these
> parameters and kindly provide an example when which parameter should to be
> set?
>
>
>
> Thanks in advance.
>
> Best regards,
>
> Manuel



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Camel Mail: MaxMessagesPerPoll vs fetchSize

2018-06-11 Thread Shenavai, Manuel
Hi everyone,

 

I got a question regarding the Camel Mail Component parameters
maxMessagesPerPoll and fetchSize. Reading the documentation, the parameters
sound quite similar. Both seem to restrict the number of messages processed
per poll. MaxMessagePerPoll seem to control the amount of messages that are
downloaded, while fetchSize specifies the number of messages consumed per
poll.

 

For me this sounds very similar. Can someone help to better understand these
parameters and kindly provide an example when which parameter should to be
set?

 

Thanks in advance.

Best regards,

Manuel



smime.p7s
Description: S/MIME cryptographic signature


RE: Rép. : RE: camel-mail IMAP mime-multipart splitAttachment

2017-12-12 Thread Daniel Langevin
OK finaly i check and mimeMultipart is supposed to be the good spell

Here the definition in camel-spring-2.17.7.xsd


MIME Multipart data format
  




Specify the subtype of the MIME Multipart. Default is mixed.. Default
value:
mixed
   

Defines whether a message without attachment is also marshaled into a
MIME
Multipart (with only one body part). Default is false.. Default value:
false
   

Defines whether the MIME-Multipart headers are part of the message body
(true)
or are set as Camel headers (false). Default is false.. Default value:
false
   

A regex that defines which Camel headers are also included as MIME
headers into
the MIME multipart. This will only work if headersInline is set to
true. Default
is to include no headers
   

Defines whether the content of binary parts in the MIME multipart is
binary
(true) or Base-64 encoded (false) Default is false.. Default value:
false
   



i can't explain why i cant use it ?? Anyone have clues ?

Regards 


Daniel


>>> "Siano, Stephan" <stephan.si...@sap.com> 2017-12-12 02:50 >>>
Hi,

the name of the xml‑element is "mime‑multipart", not "mimeMultipart".
Can you try that?

Best regards
Stephan

‑Original Message‑
From: Daniel Langevin [mailto:daniel.lange...@shq.gouv.qc.ca] 
Sent: Freitag, 8. Dezember 2017 19:56
To: users@camel.apache.org 
Subject: Rép. : RE: camel‑mail IMAP mime‑multipart splitAttachment

Hi,

i try with 


   
  


 

but receive an error into deployement.

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
Line 147 in XML document from URL
[bundle://456.1:0/META‑INF/spring/bdl.routes_XXX‑0.0.1.xml] is
invalid; nested exception is org.xml.sax.SAXParseException:
cvc‑complex‑type.2.4.a: Invalid content was found starting with
element 'mimeMultipart'.

I don't understand i user Camel 2.17.7, it supposed to be there since
2.17.1  ?


Daniel Langevin








>>> "Siano, Stephan" <stephan.si...@sap.com> 2017‑12‑08 01:50 >>>

Hi,

well, the error message means that the JMS endpoints cannot handle
binary MIME‑Messages. It tries to serialize the message in order to
store it, but the data type is not (Java) serializable.

I see two ways how you could proceed. You could either marshal the
MIME‑Message with attachments into a serialized MIME‑Multipart
(either with the MIME‑Multipart data type or with some settings in the

imap‑endpoint). This will give you one JMS message containing a
MIME‑Multipart with message and attachments (similar to the one that
goes over the wire in the mail). Or you could convert each of the split
parts into something serializable (a byte array or a String if it is
text content) before sending it the the JMS queue (convertBodyTo...).

Best regards
Stephan

‑Original Message‑
From: Daniel Langevin [mailto:daniel.lange...@shq.gouv.qc.ca] 

Sent: Donnerstag, 7. Dezember 2017 19:55
To: users@camel.apache.org 

Subject: camel‑mail IMAP mime‑multipart splitAttachment

Hi,

i try to implement a MAIL service In OSGI Karaf 4.0.9  with Camel
2.17.7, Camel‑Mail and Active‑MQ and SQL
i want to read MAIL from IMAP server, then keep It into JMS Queue an
then process each mail with mime‑multipart with attachment and insert it
into sql database

I stuck at the first Step process read MAIL and insert it into JMS.

My Case.
I have a MAIL with 2 attachments, i read the MAIL, split it into 2
messages into JMS Queue,  each message have a diiferent
CamelSplitAttachment Id, corresponding the name of the attachment file,

but i don't have the content of my MAIL or of my attachment

The body of each split contain: 

Unknown message type [org.apache.activemq.command.ActiveMQMessage]
ActiveMQMessage {commandId = 5, responseRequired = true, messageId =
.
...
...
...


I think i'm the good track, do you have an idea, what is missing ?

Only one error/warning in the log message:
JmsBinding| 46 ‑
org.apache.camel.camel‑jms ‑ 2.17.7 | Cannot determine specific
JmsMessage type to use from body class. Will use generic JmsMessage.
Body class: javax.mail.internet.MimeMultipart. If you want to send a
POJO then your class might need to implement java.io.Serializable, or
you can force a specific type by setting the jmsMessageType option on
the JMS endpoint.


Thanks!


Daniel








Here is my bundle.


http://www.springframework.org/schema/beans;

   xmlns:xsi="http://www.w3.org/2001/XMLSchema‑instance;

   xmlns:camel="http://camel.apache.org/schema/spring;

   xmlns:osgi="http://www.springframework.org/schema/osgi;

   xmlns:cxf="http://camel.apache.org/schema/cxf;

   xsi:schemaLocation="
  http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring‑beans‑2.5.xsd 

  

RE: Rép. : RE: camel-mail IMAP mime-multipart splitAttachment

2017-12-12 Thread Daniel Langevin
I ty but receive the same result with mime-multipart.

Seams like mime-multipart is not in camel-spring-2.17.7.jar.

I will checked that tommorow.  Thank's







Daniel





>>> "Siano, Stephan" <stephan.si...@sap.com> 2017-12-12 02:50 >>>
Hi,

the name of the xml‑element is "mime‑multipart", not "mimeMultipart".
Can you try that?

Best regards
Stephan

‑Original Message‑
From: Daniel Langevin [mailto:daniel.lange...@shq.gouv.qc.ca] 
Sent: Freitag, 8. Dezember 2017 19:56
To: users@camel.apache.org 
Subject: Rép. : RE: camel‑mail IMAP mime‑multipart splitAttachment

Hi,

i try with 


   
  


 

but receive an error into deployement.

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
Line 147 in XML document from URL
[bundle://456.1:0/META‑INF/spring/bdl.routes_XXX‑0.0.1.xml] is
invalid; nested exception is org.xml.sax.SAXParseException:
cvc‑complex‑type.2.4.a: Invalid content was found starting with
element 'mimeMultipart'.

I don't understand i user Camel 2.17.7, it supposed to be there since
2.17.1  ?


Daniel Langevin








>>> "Siano, Stephan" <stephan.si...@sap.com> 2017‑12‑08 01:50 >>>

Hi,

well, the error message means that the JMS endpoints cannot handle
binary MIME‑Messages. It tries to serialize the message in order to
store it, but the data type is not (Java) serializable.

I see two ways how you could proceed. You could either marshal the
MIME‑Message with attachments into a serialized MIME‑Multipart
(either with the MIME‑Multipart data type or with some settings in the
imap‑endpoint). This will give you one JMS message containing a
MIME‑Multipart with message and attachments (similar to the one that
goes over the wire in the mail). Or you could convert each of the split
parts into something serializable (a byte array or a String if it is
text content) before sending it the the JMS queue (convertBodyTo...).

Best regards
Stephan

‑Original Message‑
From: Daniel Langevin [mailto:daniel.lange...@shq.gouv.qc.ca] 

Sent: Donnerstag, 7. Dezember 2017 19:55
To: users@camel.apache.org 

Subject: camel‑mail IMAP mime‑multipart splitAttachment

Hi,

i try to implement a MAIL service In OSGI Karaf 4.0.9  with Camel
2.17.7, Camel‑Mail and Active‑MQ and SQL
i want to read MAIL from IMAP server, then keep It into JMS Queue an
then process each mail with mime‑multipart with attachment and insert it
into sql database

I stuck at the first Step process read MAIL and insert it into JMS.

My Case.
I have a MAIL with 2 attachments, i read the MAIL, split it into 2
messages into JMS Queue,  each message have a diiferent
CamelSplitAttachment Id, corresponding the name of the attachment file,

but i don't have the content of my MAIL or of my attachment

The body of each split contain: 

Unknown message type [org.apache.activemq.command.ActiveMQMessage]
ActiveMQMessage {commandId = 5, responseRequired = true, messageId =
.
...
...
...


I think i'm the good track, do you have an idea, what is missing ?

Only one error/warning in the log message:
JmsBinding| 46 ‑
org.apache.camel.camel‑jms ‑ 2.17.7 | Cannot determine specific
JmsMessage type to use from body class. Will use generic JmsMessage.
Body class: javax.mail.internet.MimeMultipart. If you want to send a
POJO then your class might need to implement java.io.Serializable, or
you can force a specific type by setting the jmsMessageType option on
the JMS endpoint.


Thanks!


Daniel








Here is my bundle.


http://www.springframework.org/schema/beans;

   xmlns:xsi="http:
//www.w3.org/2001/XMLSchema‑instance"

   xmlns:camel="http://camel.apache.org/schema/spring;

   xmlns:osgi="http://www.springframework.org/schema/osgi;

   xmlns:cxf="http://camel.apache.org/schema/cxf;

   xsi:schemaLocation="
  http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring‑beans‑2.5.xsd 

  http://camel.apache.org/schema/cxf 
http://camel.apache.org/schema/cxf/camel‑cxf.xsd 

  http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel‑spring‑2.17.7.xsd 

  http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring‑osgi.xsd; 
( 'http://www.springframework.org/schema/osgi/spring‑osgi.xsd;') >




  
 
 
  



http://camel.apache.org/schema/spring;
trace="false">





























"Le pr?sent courriel peut contenir des renseignements confidentiels et
ne s'adresse qu'au destinataire dont le nom appara?t ci‑dessus. Si ce
courriel vous est parvenu par m?garde, veuillez le supprimer

RE: Rép. : RE: camel-mail IMAP mime-multipart splitAttachment

2017-12-11 Thread Siano, Stephan
Hi,

the name of the xml-element is "mime-multipart", not "mimeMultipart". Can you 
try that?

Best regards
Stephan

-Original Message-
From: Daniel Langevin [mailto:daniel.lange...@shq.gouv.qc.ca] 
Sent: Freitag, 8. Dezember 2017 19:56
To: users@camel.apache.org
Subject: Rép. : RE: camel-mail IMAP mime-multipart splitAttachment

Hi,

i try with 


   
  


 

but receive an error into deployement.

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 147 
in XML document from URL 
[bundle://456.1:0/META-INF/spring/bdl.routes_XXX-0.0.1.xml] is invalid; nested 
exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid 
content was found starting with element 'mimeMultipart'.

I don't understand i user Camel 2.17.7, it supposed to be there since 2.17.1  
?


Daniel Langevin








>>> "Siano, Stephan" <stephan.si...@sap.com> 2017-12-08 01:50 >>>

Hi,

well, the error message means that the JMS endpoints cannot handle binary 
MIME-Messages. It tries to serialize the message in order to store it, but the 
data type is not (Java) serializable.

I see two ways how you could proceed. You could either marshal the MIME-Message 
with attachments into a serialized MIME-Multipart (either with the 
MIME-Multipart data type or with some settings in the imap-endpoint). This will 
give you one JMS message containing a MIME-Multipart with message and 
attachments (similar to the one that goes over the wire in the mail). Or you 
could convert each of the split parts into something serializable (a byte array 
or a String if it is text content) before sending it the the JMS queue 
(convertBodyTo...).

Best regards
Stephan

-Original Message-
From: Daniel Langevin [mailto:daniel.lange...@shq.gouv.qc.ca] 

Sent: Donnerstag, 7. Dezember 2017 19:55
To: users@camel.apache.org 

Subject: camel-mail IMAP mime-multipart splitAttachment

Hi,

i try to implement a MAIL service In OSGI Karaf 4.0.9  with Camel 2.17.7, 
Camel-Mail and Active-MQ and SQL
i want to read MAIL from IMAP server, then keep It into JMS Queue an then 
process each mail with mime-multipart with attachment and insert it into sql 
database

I stuck at the first Step process read MAIL and insert it into JMS.

My Case.
I have a MAIL with 2 attachments, i read the MAIL, split it into 2 messages 
into JMS Queue,  each message have a diiferent CamelSplitAttachment Id, 
corresponding the name of the attachment file, 
but i don't have the content of my MAIL or of my attachment

The body of each split contain: 

Unknown message type [org.apache.activemq.command.ActiveMQMessage] 
ActiveMQMessage {commandId = 5, responseRequired = true, messageId = .
...
...
...


I think i'm the good track, do you have an idea, what is missing ?

Only one error/warning in the log message:
JmsBinding| 46 - 
org.apache.camel.camel-jms - 2.17.7 | Cannot determine specific JmsMessage type 
to use from body class. Will use generic JmsMessage. Body class: 
javax.mail.internet.MimeMultipart. If you want to send a POJO then your class 
might need to implement java.io.Serializable, or you can force a specific type 
by setting the jmsMessageType option on the JMS endpoint.


Thanks!


Daniel








Here is my bundle.


http://www.springframework.org/schema/beans;

   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;

   xmlns:camel="http://camel.apache.org/schema/spring;

   xmlns:osgi="http://www.springframework.org/schema/osgi;

   xmlns:cxf="http://camel.apache.org/schema/cxf;

   xsi:schemaLocation="
  http://www.springframework.org/schema/beans  
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 

  http://camel.apache.org/schema/cxf  
http://camel.apache.org/schema/cxf/camel-cxf.xsd 

  http://camel.apache.org/schema/spring  
http://camel.apache.org/schema/spring/camel-spring-2.17.7.xsd 

  http://www.springframework.org/schema/osgi 
http://www.springframework.org/schema/osgi/spring-osgi.xsd;
( 'http://www.springframework.org/schema/osgi/spring-osgi.xsd;') >




  
 
 
  



http://camel.apache.org/schema/spring; trace="false">





























"Le pr?sent courriel peut contenir des renseignements confidentiels et ne 
s'adresse qu'au destinataire dont le nom appara?t ci-dessus. Si ce courriel 
vous est parvenu par m?garde, veuillez le supprimer et nous en aviser aussit?t."


"Le pr?sent courriel peut contenir des renseignements confidentiels et ne 
s'adresse qu'au destinataire dont le nom appara?t ci-dessus. Si ce courriel 
vous est parvenu par m?garde, veuillez le supprimer et nous en aviser aussit?t."


Rép. : RE: camel-mail IMAP mime-multipart splitAttachment

2017-12-08 Thread Daniel Langevin
Hi,

i try with 


   
  


 

but receive an error into deployement.

org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 147 
in XML document from URL 
[bundle://456.1:0/META-INF/spring/bdl.routes_XXX-0.0.1.xml] is invalid; nested 
exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid 
content was found starting with element 'mimeMultipart'.

I don't understand i user Camel 2.17.7, it supposed to be there since 2.17.1  
?


Daniel Langevin








>>> "Siano, Stephan" <stephan.si...@sap.com> 2017-12-08 01:50 >>>

Hi,

well, the error message means that the JMS endpoints cannot handle binary 
MIME-Messages. It tries to serialize the message in order to store it, but the 
data type is not (Java) serializable.

I see two ways how you could proceed. You could either marshal the MIME-Message 
with attachments into a serialized MIME-Multipart (either with the 
MIME-Multipart data type or with some settings in the imap-endpoint). This will 
give you one JMS message containing a MIME-Multipart with message and 
attachments (similar to the one that goes over the wire in the mail). Or you 
could convert each of the split parts into something serializable (a byte array 
or a String if it is text content) before sending it the the JMS queue 
(convertBodyTo...).

Best regards
Stephan

-Original Message-
From: Daniel Langevin [mailto:daniel.lange...@shq.gouv.qc.ca] 

Sent: Donnerstag, 7. Dezember 2017 19:55
To: users@camel.apache.org 

Subject: camel-mail IMAP mime-multipart splitAttachment

Hi,

i try to implement a MAIL service In OSGI Karaf 4.0.9  with Camel 2.17.7, 
Camel-Mail and Active-MQ and SQL
i want to read MAIL from IMAP server, then keep It into JMS Queue an then 
process each mail with mime-multipart with attachment and insert it into sql 
database

I stuck at the first Step process read MAIL and insert it into JMS.

My Case.
I have a MAIL with 2 attachments, i read the MAIL, split it into 2 messages 
into JMS Queue,  each message have a diiferent CamelSplitAttachment Id, 
corresponding the name of the attachment file, 
but i don't have the content of my MAIL or of my attachment

The body of each split contain: 

Unknown message type [org.apache.activemq.command.ActiveMQMessage] 
ActiveMQMessage {commandId = 5, responseRequired = true, messageId = .
...
...
...


I think i'm the good track, do you have an idea, what is missing ?

Only one error/warning in the log message:
JmsBinding| 46 - 
org.apache.camel.camel-jms - 2.17.7 | Cannot determine specific JmsMessage type 
to use from body class. Will use generic JmsMessage. Body class: 
javax.mail.internet.MimeMultipart. If you want to send a POJO then your class 
might need to implement java.io.Serializable, or you can force a specific type 
by setting the jmsMessageType option on the JMS endpoint.


Thanks!


Daniel








Here is my bundle.


http://www.springframework.org/schema/beans;

   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;

   xmlns:camel="http://camel.apache.org/schema/spring;

   xmlns:osgi="http://www.springframework.org/schema/osgi;

   xmlns:cxf="http://camel.apache.org/schema/cxf;

   xsi:schemaLocation="
  http://www.springframework.org/schema/beans  
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 

  http://camel.apache.org/schema/cxf  
http://camel.apache.org/schema/cxf/camel-cxf.xsd 

  http://camel.apache.org/schema/spring  
http://camel.apache.org/schema/spring/camel-spring-2.17.7.xsd 

  http://www.springframework.org/schema/osgi 
http://www.springframework.org/schema/osgi/spring-osgi.xsd;
( 'http://www.springframework.org/schema/osgi/spring-osgi.xsd;') >




  
 
 
  



http://camel.apache.org/schema/spring; trace="false">





























"Le pr?sent courriel peut contenir des renseignements confidentiels et ne 
s'adresse qu'au destinataire dont le nom appara?t ci-dessus. Si ce courriel 
vous est parvenu par m?garde, veuillez le supprimer et nous en aviser aussit?t."


"Le présent courriel peut contenir des renseignements confidentiels et ne 
s'adresse qu'au destinataire dont le nom apparaît ci-dessus. Si ce courriel 
vous est parvenu par mégarde, veuillez le supprimer et nous en aviser aussitôt."


RE: camel-mail IMAP mime-multipart splitAttachment

2017-12-07 Thread Siano, Stephan
Hi,

well, the error message means that the JMS endpoints cannot handle binary 
MIME-Messages. It tries to serialize the message in order to store it, but the 
data type is not (Java) serializable.

I see two ways how you could proceed. You could either marshal the MIME-Message 
with attachments into a serialized MIME-Multipart (either with the 
MIME-Multipart data type or with some settings in the imap-endpoint). This will 
give you one JMS message containing a MIME-Multipart with message and 
attachments (similar to the one that goes over the wire in the mail). Or you 
could convert each of the split parts into something serializable (a byte array 
or a String if it is text content) before sending it the the JMS queue 
(convertBodyTo...).

Best regards
Stephan

-Original Message-
From: Daniel Langevin [mailto:daniel.lange...@shq.gouv.qc.ca] 
Sent: Donnerstag, 7. Dezember 2017 19:55
To: users@camel.apache.org
Subject: camel-mail IMAP mime-multipart splitAttachment

Hi,

i try to implement a MAIL service In OSGI Karaf 4.0.9  with Camel 2.17.7, 
Camel-Mail and Active-MQ and SQL
i want to read MAIL from IMAP server, then keep It into JMS Queue an then 
process each mail with mime-multipart with attachment and insert it into sql 
database

I stuck at the first Step process read MAIL and insert it into JMS.

My Case.
I have a MAIL with 2 attachments, i read the MAIL, split it into 2 messages 
into JMS Queue,  each message have a diiferent CamelSplitAttachment Id, 
corresponding the name of the attachment file, 
but i don't have the content of my MAIL or of my attachment

The body of each split contain: 

Unknown message type [org.apache.activemq.command.ActiveMQMessage] 
ActiveMQMessage {commandId = 5, responseRequired = true, messageId = .
...
...
...


I think i'm the good track, do you have an idea, what is missing ?

Only one error/warning in the log message:
JmsBinding  | 46 - org.apache.camel.camel-jms - 2.17.7 
| Cannot determine specific JmsMessage type to use from body class. Will use 
generic JmsMessage. Body class: javax.mail.internet.MimeMultipart. If you want 
to send a POJO then your class might need to implement java.io.Serializable, or 
you can force a specific type by setting the jmsMessageType option on the JMS 
endpoint.


Thanks!


Daniel








Here is my bundle.


http://www.springframework.org/schema/beans;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
   xmlns:camel="http://camel.apache.org/schema/spring;
   xmlns:osgi="http://www.springframework.org/schema/osgi;
   xmlns:cxf="http://camel.apache.org/schema/cxf;
   xsi:schemaLocation="
  http://www.springframework.org/schema/beans  
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
  http://camel.apache.org/schema/cxf  
http://camel.apache.org/schema/cxf/camel-cxf.xsd 
  http://camel.apache.org/schema/spring  
http://camel.apache.org/schema/spring/camel-spring-2.17.7.xsd 
  http://www.springframework.org/schema/osgi 
http://www.springframework.org/schema/osgi/spring-osgi.xsd;>



  
 
 
  



http://camel.apache.org/schema/spring; trace="false">


 
 
 



 
 


















"Le pr?sent courriel peut contenir des renseignements confidentiels et ne 
s'adresse qu'au destinataire dont le nom appara?t ci-dessus. Si ce courriel 
vous est parvenu par m?garde, veuillez le supprimer et nous en aviser aussit?t."


camel-mail IMAP mime-multipart splitAttachment

2017-12-07 Thread Daniel Langevin
Hi,

i try to implement a MAIL service In OSGI Karaf 4.0.9  with Camel 2.17.7, 
Camel-Mail and Active-MQ and SQL
i want to read MAIL from IMAP server, then keep It into JMS Queue an then 
process each mail with mime-multipart with attachment and insert it into sql 
database

I stuck at the first Step process read MAIL and insert it into JMS.

My Case.
I have a MAIL with 2 attachments, i read the MAIL, split it into 2 messages 
into JMS Queue,  each message have a diiferent CamelSplitAttachment Id, 
corresponding the name of the attachment file, 
but i don't have the content of my MAIL or of my attachment

The body of each split contain: 

Unknown message type [org.apache.activemq.command.ActiveMQMessage] 
ActiveMQMessage {commandId = 5, responseRequired = true, messageId = .
...
...
...


I think i'm the good track, do you have an idea, what is missing ?

Only one error/warning in the log message:
JmsBinding  | 46 - org.apache.camel.camel-jms - 2.17.7 
| Cannot determine specific JmsMessage type to use from body class. Will use 
generic JmsMessage. Body class: javax.mail.internet.MimeMultipart. If you want 
to send a POJO then your class might need to implement java.io.Serializable, or 
you can force a specific type by setting the jmsMessageType option on the JMS 
endpoint.


Thanks!


Daniel








Here is my bundle.


http://www.springframework.org/schema/beans;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
   xmlns:camel="http://camel.apache.org/schema/spring;
   xmlns:osgi="http://www.springframework.org/schema/osgi;
   xmlns:cxf="http://camel.apache.org/schema/cxf;
   xsi:schemaLocation="
  http://www.springframework.org/schema/beans  
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
  http://camel.apache.org/schema/cxf  
http://camel.apache.org/schema/cxf/camel-cxf.xsd 
  http://camel.apache.org/schema/spring  
http://camel.apache.org/schema/spring/camel-spring-2.17.7.xsd 
  http://www.springframework.org/schema/osgi 
http://www.springframework.org/schema/osgi/spring-osgi.xsd;>



  
 
 
  



http://camel.apache.org/schema/spring; trace="false">


 
 
 



 
 


















"Le présent courriel peut contenir des renseignements confidentiels et ne 
s'adresse qu'au destinataire dont le nom apparaît ci-dessus. Si ce courriel 
vous est parvenu par mégarde, veuillez le supprimer et nous en aviser aussitôt."


Re: Camel Mail sends the same email twice

2017-05-23 Thread raja
Hi,
  I dont know about ur coding.So I can't tell what causing the problem
exactly. But I can assure camel Route wont send mail twice.
If u starting the camel route manually from your code then check
your the route is started only once.
If you are using bean to attach the mail content check the bean for
does it call the route each time for the attachement.

   Increase the no. of attachment and check how many mail u are
receiving.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Mail-sends-the-same-email-twice-tp5800048p5800067.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Mail sends the same email twice

2017-05-23 Thread Laurentiu Trica
Hi,

The route is a ripped of version of a more complex one.
But what can influence the Camel Mail to send the email twice? Do you have
any idea?

Thanks!
Laurentiu

On Tue, May 23, 2017 at 12:08 PM, raja <r...@meru.co.in> wrote:

> Hi,
>  The Route is working fine.when executing the Route I received the mail
> only once.If you are receiving the mail twice means the problem is not with
> the Given ROUTE.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/Camel-Mail-sends-the-same-email-twice-tp5800048p5800049.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>


Re: Camel Mail sends the same email twice

2017-05-23 Thread raja
Hi,
 The Route is working fine.when executing the Route I received the mail
only once.If you are receiving the mail twice means the problem is not with
the Given ROUTE.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Mail-sends-the-same-email-twice-tp5800048p5800049.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel Mail sends the same email twice

2017-05-23 Thread Laurentiu Trica
Hello,

I have an issue with Camel Mail in Camel 2.13.
It sends the email twice.

The DSL is bellow:


  exam...@mail.com


  b...@mail.com


  Test


  Test




What can it be? The fact that I have 2 attachments? Does the fact that
there is a to and a BCC have any influence?

Thanks for reading!

Regards,
Laurentiu


Camel Mail Component doesn't handle multiple attachments with same file name properly

2016-12-02 Thread Petteri

Hi,

I'm using Apache Camel and its mail component to read emails and their 
attachments.


I have encountered a problem which occurs when handling mails with 
multiple attachments using the same file name.


It seems that the problem is caused by the use of Map<String, 
DataHandler> type in org.apache.camel.component.mail.MailBinding. 
Attachments are looped and checked against this map. If the map already 
contains a key with the same file name, attachment is skipped:


https://github.com/apache/camel/blob/camel-2.10.x/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailBinding.java#L327

Maybe this key value could be somehow incremented so the map could 
contain all attachments despite of their file names?


I'm using Camel version 2.10.7 but the code seems to be unchanged by 
this part in current version too.


This kind of mails are regularly coming from end users of our software 
and there's no easy way to circumvent this from our side.


Thanks.



Re: camel-mail: Body ends up as attachment instead of e-mail body in multipart mail.

2016-11-11 Thread Andreas A.
Thanks guys, setting the content type to text/plain did the trick.



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-mail-Body-ends-up-as-attachment-instead-of-e-mail-body-in-multipart-mail-tp5789939p5790037.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-mail: Body ends up as attachment instead of e-mail body in multipart mail.

2016-11-10 Thread AOladipupo
you need to set the content type as part of the uri options or in the
exchange header (will overite the uri values). See modified section of your
code below:


@Override 
public void process(Exchange exchange) throws Exception { 
Message in = exchange.getIn(); 
FileDataSource file = new
javax.activation.FileDataSource("H:\\file.txt"); 
in.addAttachment("report.txt", new
DataHandler(file)); 
*in.setHeader("contentType", "text/html");*
in.setBody("Hello"); 
} 



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-mail-Body-ends-up-as-attachment-instead-of-e-mail-body-in-multipart-mail-tp5789939p5790006.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-mail: Body ends up as attachment instead of e-mail body in multipart mail.

2016-11-10 Thread jmaurin
Hello,

we had got the same problem (ie a attachement file as body). 

To resolve it, we have 'force' the content type in the header as : 

 in.setHeader("contentType", "text/plain");

Best regards,
jmaurin

Camel version :  2.14.1



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-mail-Body-ends-up-as-attachment-instead-of-e-mail-body-in-multipart-mail-tp5789939p5790005.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-mail: Body ends up as attachment instead of e-mail body in multipart mail.

2016-11-10 Thread Claus Ibsen
Also a good idea can be to look at the existing unit tests of
camel-mail, to see how some of those does it with file attachments.

On Thu, Nov 10, 2016 at 10:18 AM, Andreas A. <andreasasm...@gmail.com> wrote:
> I'm using 2.17.3. I guess I could try 2.18.0.
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/camel-mail-Body-ends-up-as-attachment-instead-of-e-mail-body-in-multipart-mail-tp5789939p5789989.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: camel-mail: Body ends up as attachment instead of e-mail body in multipart mail.

2016-11-10 Thread Andreas A.
I'm using 2.17.3. I guess I could try 2.18.0.



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-mail-Body-ends-up-as-attachment-instead-of-e-mail-body-in-multipart-mail-tp5789939p5789989.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-mail: Body ends up as attachment instead of e-mail body in multipart mail.

2016-11-09 Thread Claus Ibsen
Not sure what Camel version you use, but tell us, and try test with
newer release.

On Wed, Nov 9, 2016 at 10:44 AM, Andreas A. <andreasasm...@gmail.com> wrote:
> I'm trying to send an e-mail with a subject, body and attached file. The
> subject and attached file works fine. However when I make an attachment, the
> body of the email ends up as an unnamed attachment in the final mail.
>
> Is this a bug in Camel or do I need to do something to make sure the
> Camel-body becomes a "bodyPart" and not an attachment?
>
> Example route:
>
> from("direct:sendReportEmailRoute")
> .routeId("sendReportEmailRoute")
> .setProperty("originalBody", body())
> .process(new Processor() {
>
> @Override
> public void process(Exchange exchange) throws Exception {
> Message in = exchange.getIn();
> FileDataSource file = new
> javax.activation.FileDataSource("H:\\file.txt");
> in.addAttachment("report.txt", new DataHandler(file));
> in.setBody("Hello");
> }
>
> })
>
> .to("smtp:xxx?to=x...@xxx.com,andreasasm...@gmail.com=nore...@xxx.dk=Your
> report")
> .setBody(simple("${property.originalBody}"));
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/camel-mail-Body-ends-up-as-attachment-instead-of-e-mail-body-in-multipart-mail-tp5789939.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


camel-mail: Body ends up as attachment instead of e-mail body in multipart mail.

2016-11-09 Thread Andreas A.
I'm trying to send an e-mail with a subject, body and attached file. The
subject and attached file works fine. However when I make an attachment, the
body of the email ends up as an unnamed attachment in the final mail.

Is this a bug in Camel or do I need to do something to make sure the
Camel-body becomes a "bodyPart" and not an attachment?

Example route:

from("direct:sendReportEmailRoute")
.routeId("sendReportEmailRoute")
.setProperty("originalBody", body())
.process(new Processor() {

@Override
public void process(Exchange exchange) throws Exception {
Message in = exchange.getIn();
FileDataSource file = new
javax.activation.FileDataSource("H:\\file.txt");
in.addAttachment("report.txt", new DataHandler(file));
in.setBody("Hello");
}

})

.to("smtp:xxx?to=x...@xxx.com,andreasasm...@gmail.com=nore...@xxx.dk=Your
report")
.setBody(simple("${property.originalBody}"));



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-mail-Body-ends-up-as-attachment-instead-of-e-mail-body-in-multipart-mail-tp5789939.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Mail: Sending both text and html version of e-mail

2016-10-18 Thread Claus Ibsen
Hi

See the alternativeBodyHeader option at http://camel.apache.org/mail.html

On Thu, Oct 13, 2016 at 8:33 PM, dash <peter.tul...@gmail.com> wrote:
> Hello.
> I need to send both /text/html/ and /text/plain/ versions in one email. Can
> this be done using Camel SMTP component?
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-Mail-Sending-both-text-and-html-version-of-e-mail-tp5788739.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Camel Mail: Sending both text and html version of e-mail

2016-10-13 Thread dash
Hello.
I need to send both /text/html/ and /text/plain/ versions in one email. Can
this be done using Camel SMTP component?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Mail-Sending-both-text-and-html-version-of-e-mail-tp5788739.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel-Mail - Consume from IMAP with variable searchTerm.fromSentDate

2016-10-10 Thread Michael Täschner
Hi Claus,

do you see a possibility that the MailConsumer can be extended to support
dynamic parameters? Especially SearchTerms like "SentDate" are rather
dynamic in nature - otherwilse mails will be polled over and over again if
other searchTerms like "unseen" cannot be applied.

Thanks and Best Regards,
Michael

2016-10-07 10:20 GMT+02:00 Michael Täschner <m.taesch...@gmail.com>:

> Unfortunately it is not sufficient to provide own SearchTerm class and
> overriding "match" because com.sun.mail.imap.protocol.SearchSequence
> checks specific implementations of SearchTerm provided by com.sun.mail and
> all implementations are final. I worked around the issue by resetting the
> searchTerm in Camel MailEndpoint everytime I want to update the criteria.
> This works as MailConsumer retrieves the searchTerm from the endpoint on
> each poll.
>
> 2016-10-06 13:21 GMT+02:00 Claus Ibsen <claus.ib...@gmail.com>:
>
>> I think you just need to keep state yourself in the bean, and then the
>> mail component will call the match method to see if a mail messages
>> matches or not.
>>
>> Then your state can then update with new sent date information so the
>> matches method can use a newer date.
>>
>> On Thu, Oct 6, 2016 at 2:43 AM, Michael Täschner <m.taesch...@gmail.com>
>> wrote:
>> > Hi Again,
>> >
>> > is there a possibility that the searchTerm bean reference picked up by
>> > camel-mail can update it's internal state to allow for a changing
>> sentDate
>> > for the query?
>> >
>> > Thanks and Best Regards,
>> > Michael
>> >
>> > 2016-09-23 16:21 GMT+02:00 Michael Täschner <m.taesch...@gmail.com>:
>> >
>> >> Hi Camel-Riders,
>> >>
>> >> is there a possibility to consume mails with modifiable
>> >> searchTerm.fromSentDate value? I am looking at a solution where the
>> >> consumer must not depend on "unseen" flag, manages an internal dateTime
>> >> variable to pick-up mail search from where it last stopped?  There may
>> be
>> >> other clients on the mail account and I cannot depend on the "unseen"
>> flag.
>> >> Is this a case for poll-enrich or how can I manipulate the from query
>> to
>> >> use the variable "searchTerm.fromSentDate"?
>> >>
>> >> Thanks and Best Regards,
>> >> Michael
>> >>
>>
>>
>>
>> --
>> Claus Ibsen
>> -
>> http://davsclaus.com @davsclaus
>> Camel in Action 2: https://www.manning.com/ibsen2
>>
>
>


Re: Camel-Mail - Consume from IMAP with variable searchTerm.fromSentDate

2016-10-07 Thread Michael Täschner
Unfortunately it is not sufficient to provide own SearchTerm class and
overriding "match" because com.sun.mail.imap.protocol.SearchSequence checks
specific implementations of SearchTerm provided by com.sun.mail and all
implementations are final. I worked around the issue by resetting the
searchTerm in Camel MailEndpoint everytime I want to update the criteria.
This works as MailConsumer retrieves the searchTerm from the endpoint on
each poll.

2016-10-06 13:21 GMT+02:00 Claus Ibsen <claus.ib...@gmail.com>:

> I think you just need to keep state yourself in the bean, and then the
> mail component will call the match method to see if a mail messages
> matches or not.
>
> Then your state can then update with new sent date information so the
> matches method can use a newer date.
>
> On Thu, Oct 6, 2016 at 2:43 AM, Michael Täschner <m.taesch...@gmail.com>
> wrote:
> > Hi Again,
> >
> > is there a possibility that the searchTerm bean reference picked up by
> > camel-mail can update it's internal state to allow for a changing
> sentDate
> > for the query?
> >
> > Thanks and Best Regards,
> > Michael
> >
> > 2016-09-23 16:21 GMT+02:00 Michael Täschner <m.taesch...@gmail.com>:
> >
> >> Hi Camel-Riders,
> >>
> >> is there a possibility to consume mails with modifiable
> >> searchTerm.fromSentDate value? I am looking at a solution where the
> >> consumer must not depend on "unseen" flag, manages an internal dateTime
> >> variable to pick-up mail search from where it last stopped?  There may
> be
> >> other clients on the mail account and I cannot depend on the "unseen"
> flag.
> >> Is this a case for poll-enrich or how can I manipulate the from query to
> >> use the variable "searchTerm.fromSentDate"?
> >>
> >> Thanks and Best Regards,
> >> Michael
> >>
>
>
>
> --
> Claus Ibsen
> -
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


Re: Camel-Mail - Consume from IMAP with variable searchTerm.fromSentDate

2016-10-06 Thread Claus Ibsen
I think you just need to keep state yourself in the bean, and then the
mail component will call the match method to see if a mail messages
matches or not.

Then your state can then update with new sent date information so the
matches method can use a newer date.

On Thu, Oct 6, 2016 at 2:43 AM, Michael Täschner <m.taesch...@gmail.com> wrote:
> Hi Again,
>
> is there a possibility that the searchTerm bean reference picked up by
> camel-mail can update it's internal state to allow for a changing sentDate
> for the query?
>
> Thanks and Best Regards,
> Michael
>
> 2016-09-23 16:21 GMT+02:00 Michael Täschner <m.taesch...@gmail.com>:
>
>> Hi Camel-Riders,
>>
>> is there a possibility to consume mails with modifiable
>> searchTerm.fromSentDate value? I am looking at a solution where the
>> consumer must not depend on "unseen" flag, manages an internal dateTime
>> variable to pick-up mail search from where it last stopped?  There may be
>> other clients on the mail account and I cannot depend on the "unseen" flag.
>> Is this a case for poll-enrich or how can I manipulate the from query to
>> use the variable "searchTerm.fromSentDate"?
>>
>> Thanks and Best Regards,
>> Michael
>>



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Camel-Mail - Consume from IMAP with variable searchTerm.fromSentDate

2016-10-06 Thread Michael Täschner
Hi Again,

is there a possibility that the searchTerm bean reference picked up by
camel-mail can update it's internal state to allow for a changing sentDate
for the query?

Thanks and Best Regards,
Michael

2016-09-23 16:21 GMT+02:00 Michael Täschner <m.taesch...@gmail.com>:

> Hi Camel-Riders,
>
> is there a possibility to consume mails with modifiable
> searchTerm.fromSentDate value? I am looking at a solution where the
> consumer must not depend on "unseen" flag, manages an internal dateTime
> variable to pick-up mail search from where it last stopped?  There may be
> other clients on the mail account and I cannot depend on the "unseen" flag.
> Is this a case for poll-enrich or how can I manipulate the from query to
> use the variable "searchTerm.fromSentDate"?
>
> Thanks and Best Regards,
> Michael
>


Camel-Mail - Consume from IMAP with variable searchTerm.fromSentDate

2016-09-23 Thread Michael Täschner
Hi Camel-Riders,

is there a possibility to consume mails with modifiable
searchTerm.fromSentDate value? I am looking at a solution where the
consumer must not depend on "unseen" flag, manages an internal dateTime
variable to pick-up mail search from where it last stopped?  There may be
other clients on the mail account and I cannot depend on the "unseen" flag.
Is this a case for poll-enrich or how can I manipulate the from query to
use the variable "searchTerm.fromSentDate"?

Thanks and Best Regards,
Michael


Re: How to Disable AUTH for camel mail smtp component?

2016-07-28 Thread sfbayperson2016
Answering my own question. Setting "mail.smtp.auth=false" as a smtp uri query
param worked. I had problems getting it to work due to a typo which
prevented that from triggering.



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-Disable-AUTH-for-camel-mail-smtp-component-tp5785598p5785599.html
Sent from the Camel - Users mailing list archive at Nabble.com.


How to Disable AUTH for camel mail smtp component?

2016-07-28 Thread sfbayperson2016
I'm able to connect to my smtp server directly without a user/password. But
camel-mail seems to require it? As I keep getting a
javax.mail.AuthenticationFailedException camel is passing back from
javamail.  Basically I want camel-mail to pass a javamail seesion property
"mail.smtp.auth=false" to javamail somehow. 



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-Disable-AUTH-for-camel-mail-smtp-component-tp5785598.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel-mail leave message unseen while searching

2016-05-27 Thread metalalisa
I need another behavior. I need to leave the seen flag unchanged. Should I
add another one property to the endpoint and make pull request?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-mail-leave-message-unseen-while-searching-tp5783119p5783156.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel-mail leave message unseen while searching

2016-05-26 Thread Claus Ibsen
On Thu, May 26, 2016 at 7:47 PM, metalalisa <metalal...@gmail.com> wrote:
> Of course! Thanks for quick reply.
>
>
>> imaps://imap.gmail.com?username=*@gmail.com=*=false=1=true=now-72h
>
> My camel-mail version is 2.17.1
>

So what is the problem? All mails that are processed by camel-mail
will be marked as SEEN when it has been processed.

Is there something about using search term you mean are not as expected?

>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-mail-leave-message-unseen-while-searching-tp5783119p5783131.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Re: Camel-mail leave message unseen while searching

2016-05-26 Thread metalalisa
Of course! Thanks for quick reply.


> imaps://imap.gmail.com?username=*@gmail.com=*=false=1=true=now-72h

My camel-mail version is 2.17.1



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-mail-leave-message-unseen-while-searching-tp5783119p5783131.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel-mail leave message unseen while searching

2016-05-26 Thread Claus Ibsen
Can you tell us which Camel version, and what do you mean by
searching? Can you show the camel route / mail endpoint you have
configured?

On Thu, May 26, 2016 at 6:57 PM, metalalisa <metalal...@gmail.com> wrote:
> Could you help me to understand why camel-imap marks messages as seen while I
> call search with terms?
> Is there any way to leave this flag unchanged while searching?
>
> Thanks
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Camel-mail-leave-message-unseen-while-searching-tp5783119.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Camel-mail leave message unseen while searching

2016-05-26 Thread metalalisa
Could you help me to understand why camel-imap marks messages as seen while I
call search with terms?
Is there any way to leave this flag unchanged while searching?

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-mail-leave-message-unseen-while-searching-tp5783119.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel mail component to get email notification(Instead of polling)

2015-08-12 Thread Claus Ibsen
Hi

No its polling based. But I think there is a JIRA about a event based
but that would require the mail server to support this, and also to
implement the needed code to do so. Not sure if the java mail api
supports this.


On Wed, Aug 12, 2015 at 8:55 AM, NewCamelDev krishna.alap...@ymail.com wrote:
 Hi All, I am new to camel and we are using the camel mail component to read
 some emails on some fixed delay of 30 seconds. However our customer
 complaints on receiving these emails in our application and I believe
 decreasing the polling interval may increase the load on the server.

 Would there be an other way to retrieve the emails from camel mail
 component? Like registering a component that gets notified upon receiving an
 email in the mail box instead of polling?

 Thank you,
 Alapati.



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Camel-mail-component-to-get-email-notification-Instead-of-polling-tp5770598.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2


Camel mail component to get email notification(Instead of polling)

2015-08-12 Thread NewCamelDev
Hi All, I am new to camel and we are using the camel mail component to read
some emails on some fixed delay of 30 seconds. However our customer
complaints on receiving these emails in our application and I believe
decreasing the polling interval may increase the load on the server. 

Would there be an other way to retrieve the emails from camel mail
component? Like registering a component that gets notified upon receiving an
email in the mail box instead of polling?

Thank you,
Alapati.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-mail-component-to-get-email-notification-Instead-of-polling-tp5770598.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Mail mapMailMessage flag ignored

2015-05-17 Thread Claus Ibsen
Hi

Yeah the uow copy would cause the message to be initialized. You can
however turn off allowUseOriginalMessage which is what Camel also
recommends if you dont need that functionality, and the copy is not
needed.

On Wed, May 6, 2015 at 6:36 PM,  wru...@loftware.com wrote:
 Can you tell me what I would look for in the exchange to tell the difference.

 At the very first line of the very first processor coming directly off of the 
 imap endpoint, I put a debug break point.

 This is absolutely the first place in the code where I as a camel user can do 
 anything with the exchange.

 With mapMailMessage set to false, I inspect the message and every single mail 
 message header is already mapped to the MailMessage headers map.

 When I look further up the code stream I see that the mapping is happening 
 always during the construction of DefaultUnitOfWork while doing internal 
 standard advice as part of the CamelInternalProcessor. At which point it is 
 doing an message copy.

 There is no way to avoid this (at least that I know of) and there is 
 obviously nothing mail client specific code at that point of the exchange.

 Since the configuration point changes nothing in how the exchange is 
 processed I will assume this is bug resulting in a completely dead and 
 useless configuration point.



 -Original Message-
 From: Claus Ibsen [mailto:claus.ib...@gmail.com]
 Sent: Wednesday, May 06, 2015 11:35 AM
 To: users@camel.apache.org
 Subject: Re: Camel Mail mapMailMessage flag ignored

 Hi

 Read the description. Its about whether mail message headers and body is 
 mapped to Camel Message Body / Headers automatic or lazy-on-demand.

 From outside you cant tell the difference unless you work with the low level 
 message api.

 On Wed, May 6, 2015 at 5:32 PM, wrusch wru...@loftware.com wrote:
 I expect the flag to do something?

 I really don't understand your reply.

 No matter what value I set, nothing changes.

 For pop3 the mapping happens 'never'
 For imap the mapping happens 'always'

 In either case the flag does nothing at all.



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Camel-Mail-mapMailMessage-flag-ignor
 ed-tp5766767p5766771.html Sent from the Camel - Users mailing list
 archive at Nabble.com.



 --
 Claus Ibsen
 -
 Red Hat, Inc.
 Email: cib...@redhat.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen
 hawtio: http://hawt.io/
 fabric8: http://fabric8.io/




-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: Camel Mail mapMailMessage flag ignored

2015-05-17 Thread Claus Ibsen
Hi

I found a spot for improving
https://issues.apache.org/jira/browse/CAMEL-8779

Thanks for spotting this.

On Sun, May 17, 2015 at 8:37 AM, Claus Ibsen claus.ib...@gmail.com wrote:
 Hi

 Yeah the uow copy would cause the message to be initialized. You can
 however turn off allowUseOriginalMessage which is what Camel also
 recommends if you dont need that functionality, and the copy is not
 needed.

 On Wed, May 6, 2015 at 6:36 PM,  wru...@loftware.com wrote:
 Can you tell me what I would look for in the exchange to tell the difference.

 At the very first line of the very first processor coming directly off of 
 the imap endpoint, I put a debug break point.

 This is absolutely the first place in the code where I as a camel user can 
 do anything with the exchange.

 With mapMailMessage set to false, I inspect the message and every single 
 mail message header is already mapped to the MailMessage headers map.

 When I look further up the code stream I see that the mapping is happening 
 always during the construction of DefaultUnitOfWork while doing internal 
 standard advice as part of the CamelInternalProcessor. At which point it is 
 doing an message copy.

 There is no way to avoid this (at least that I know of) and there is 
 obviously nothing mail client specific code at that point of the exchange.

 Since the configuration point changes nothing in how the exchange is 
 processed I will assume this is bug resulting in a completely dead and 
 useless configuration point.



 -Original Message-
 From: Claus Ibsen [mailto:claus.ib...@gmail.com]
 Sent: Wednesday, May 06, 2015 11:35 AM
 To: users@camel.apache.org
 Subject: Re: Camel Mail mapMailMessage flag ignored

 Hi

 Read the description. Its about whether mail message headers and body is 
 mapped to Camel Message Body / Headers automatic or lazy-on-demand.

 From outside you cant tell the difference unless you work with the low level 
 message api.

 On Wed, May 6, 2015 at 5:32 PM, wrusch wru...@loftware.com wrote:
 I expect the flag to do something?

 I really don't understand your reply.

 No matter what value I set, nothing changes.

 For pop3 the mapping happens 'never'
 For imap the mapping happens 'always'

 In either case the flag does nothing at all.



 --
 View this message in context:
 http://camel.465427.n5.nabble.com/Camel-Mail-mapMailMessage-flag-ignor
 ed-tp5766767p5766771.html Sent from the Camel - Users mailing list
 archive at Nabble.com.



 --
 Claus Ibsen
 -
 Red Hat, Inc.
 Email: cib...@redhat.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen
 hawtio: http://hawt.io/
 fabric8: http://fabric8.io/




 --
 Claus Ibsen
 -
 Red Hat, Inc.
 Email: cib...@redhat.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen
 hawtio: http://hawt.io/
 fabric8: http://fabric8.io/



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Camel Mail mapMailMessage flag ignored

2015-05-06 Thread wrusch
I am testing with camel-mail 2.14.

I am testing both pop3 and imap email consumers.

When i toggle the mapMailMessage flag nothing changes at all with the
message.

Additionally, 
pop3 never maps the message 

imap always maps the message

here are examples of my tested URIs (the only thing i changed between tests
was the mapMailMessage flag for each protocol.

pop3s://camel-test@localdomain:110?closeFolder=trueconnectionTimeout=3consumer.delay=6000consumer.initialDelay=1000contentType=text%2Fplaindisconnect=falsefetchSize=-1mapMailMessage=truemaxMessagesPerPoll=0password=passwordprotocol=pop3delete=true

imaps://camel-test@localdomain:143?closeFolder=trueconnectionTimeout=3consumer.delay=6000consumer.initialDelay=1000contentType=text%2Fhtmldelete=truedisconnect=falsefetchSize=-1folderName=INBOXmapMailMessage=falsemaxMessagesPerPoll=0password=passwordpeek=trueprotocol=imapsearchTerm.unseen=trueunseen=true

Am I just doing something wrong?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Mail-mapMailMessage-flag-ignored-tp5766767.html
Sent from the Camel - Users mailing list archive at Nabble.com.


RE: Camel Mail mapMailMessage flag ignored

2015-05-06 Thread wrusch
Can you tell me what I would look for in the exchange to tell the difference.

At the very first line of the very first processor coming directly off of the 
imap endpoint, I put a debug break point.

This is absolutely the first place in the code where I as a camel user can do 
anything with the exchange.

With mapMailMessage set to false, I inspect the message and every single mail 
message header is already mapped to the MailMessage headers map.

When I look further up the code stream I see that the mapping is happening 
always during the construction of DefaultUnitOfWork while doing internal 
standard advice as part of the CamelInternalProcessor. At which point it is 
doing an message copy.

There is no way to avoid this (at least that I know of) and there is obviously 
nothing mail client specific code at that point of the exchange.

Since the configuration point changes nothing in how the exchange is processed 
I will assume this is bug resulting in a completely dead and useless 
configuration point. 



-Original Message-
From: Claus Ibsen [mailto:claus.ib...@gmail.com] 
Sent: Wednesday, May 06, 2015 11:35 AM
To: users@camel.apache.org
Subject: Re: Camel Mail mapMailMessage flag ignored

Hi

Read the description. Its about whether mail message headers and body is mapped 
to Camel Message Body / Headers automatic or lazy-on-demand.

From outside you cant tell the difference unless you work with the low level 
message api.

On Wed, May 6, 2015 at 5:32 PM, wrusch wru...@loftware.com wrote:
 I expect the flag to do something?

 I really don't understand your reply.

 No matter what value I set, nothing changes.

 For pop3 the mapping happens 'never'
 For imap the mapping happens 'always'

 In either case the flag does nothing at all.



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Camel-Mail-mapMailMessage-flag-ignor
 ed-tp5766767p5766771.html Sent from the Camel - Users mailing list 
 archive at Nabble.com.



--
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/



Re: Camel Mail mapMailMessage flag ignored

2015-05-06 Thread Claus Ibsen
Hi

What would you expect to happen? The option is a flag to turn lazy
mapping on or off.

On Wed, May 6, 2015 at 4:41 PM, wrusch wru...@loftware.com wrote:
 I am testing with camel-mail 2.14.

 I am testing both pop3 and imap email consumers.

 When i toggle the mapMailMessage flag nothing changes at all with the
 message.

 Additionally,
 pop3 never maps the message

 imap always maps the message

 here are examples of my tested URIs (the only thing i changed between tests
 was the mapMailMessage flag for each protocol.

 pop3s://camel-test@localdomain:110?closeFolder=trueconnectionTimeout=3consumer.delay=6000consumer.initialDelay=1000contentType=text%2Fplaindisconnect=falsefetchSize=-1mapMailMessage=truemaxMessagesPerPoll=0password=passwordprotocol=pop3delete=true

 imaps://camel-test@localdomain:143?closeFolder=trueconnectionTimeout=3consumer.delay=6000consumer.initialDelay=1000contentType=text%2Fhtmldelete=truedisconnect=falsefetchSize=-1folderName=INBOXmapMailMessage=falsemaxMessagesPerPoll=0password=passwordpeek=trueprotocol=imapsearchTerm.unseen=trueunseen=true

 Am I just doing something wrong?



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Camel-Mail-mapMailMessage-flag-ignored-tp5766767.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: Camel Mail mapMailMessage flag ignored

2015-05-06 Thread wrusch
I expect the flag to do something?

I really don't understand your reply.

No matter what value I set, nothing changes.

For pop3 the mapping happens 'never'
For imap the mapping happens 'always'

In either case the flag does nothing at all.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Mail-mapMailMessage-flag-ignored-tp5766767p5766771.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Camel Mail mapMailMessage flag ignored

2015-05-06 Thread Claus Ibsen
Hi

Read the description. Its about whether mail message headers and body
is mapped to Camel Message Body / Headers automatic or lazy-on-demand.

From outside you cant tell the difference unless you work with the low
level message api.

On Wed, May 6, 2015 at 5:32 PM, wrusch wru...@loftware.com wrote:
 I expect the flag to do something?

 I really don't understand your reply.

 No matter what value I set, nothing changes.

 For pop3 the mapping happens 'never'
 For imap the mapping happens 'always'

 In either case the flag does nothing at all.



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Camel-Mail-mapMailMessage-flag-ignored-tp5766767p5766771.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Re: Unable to send text in mail body other than English using Camel mail

2015-01-14 Thread Claus Ibsen
Hi

It sounds like you need to set encoding to a charset for japanese characters.
I think you set that as part of the content-type header.

On Wed, Jan 14, 2015 at 3:50 PM, Mithu Tokder mithutok...@gmail.com wrote:
 Hi All,
 I have developed a mail functionality to send mail. User can put any text
 like English, Japanese or other text. When the mail body is in english mail
 successfully sent, but if the body is other that english then the mail sent
 to the receiver as  in mail body.

 Is there any way to send mail with japanese text in mail body.
 I am sending mail body as HTML markup.

 Any help is appropriated.

 Thanks in advance.

 Regards,
 Mithu Tokder



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


Unable to send text in mail body other than English using Camel mail

2015-01-14 Thread Mithu Tokder
Hi All,
I have developed a mail functionality to send mail. User can put any text
like English, Japanese or other text. When the mail body is in english mail
successfully sent, but if the body is other that english then the mail sent
to the receiver as  in mail body.

Is there any way to send mail with japanese text in mail body.
I am sending mail body as HTML markup.

Any help is appropriated.

Thanks in advance.

Regards,
Mithu Tokder


Re: Camel Mail CC and BCC headers

2014-10-27 Thread Willem Jiang
Hi,

I just create a JIRA[1] and submitted a quick fix for it.
Please feel free to verify it by using latest Camel 2.15-SNAPSHOT.

[1]https://issues.apache.org/jira/browse/CAMEL-7966

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On October 23, 2014 at 11:21:50 PM, ychawla (premiergenerat...@gmail.com) wrote:
 Hello All,
 The MailBinding class contains this method
 setRecipientFromEndpointConfiguration. Perhaps it is just as easy as
 checking the recipients map to see if the CC or BCC are blank or empty
 string prior to setting them in the method. If so, I wouldn't mind
 submitting a patch for this.
  
 Thanks,
 Yogesh
  
 /**
 * Appends the Mail headers from the endpoint configuration.
 */
 protected void setRecipientFromEndpointConfiguration(MimeMessage
 mimeMessage, MailEndpoint endpoint, Exchange exchange)
 throws MessagingException, IOException {
  
 Map recipients =
 endpoint.getConfiguration().getRecipients();
 if (recipients.containsKey(Message.RecipientType.TO)) {
 appendRecipientToMimeMessage(mimeMessage,
 endpoint.getConfiguration(), exchange, Message.RecipientType.TO.toString(),  
 recipients.get(Message.RecipientType.TO));
 }
 if (recipients.containsKey(Message.RecipientType.CC)) {
 appendRecipientToMimeMessage(mimeMessage,
 endpoint.getConfiguration(), exchange, Message.RecipientType.CC.toString(),  
 recipients.get(Message.RecipientType.CC));
 }
 if (recipients.containsKey(Message.RecipientType.BCC)) {
 appendRecipientToMimeMessage(mimeMessage,
 endpoint.getConfiguration(), exchange, Message.RecipientType.BCC.toString(),  
 recipients.get(Message.RecipientType.BCC));
 }
 }
  
  
  
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Camel-Mail-CC-and-BCC-headers-tp5757943p5757950.html
   
 Sent from the Camel - Users mailing list archive at Nabble.com.
  



Re: Camel Mail CC and BCC headers

2014-10-27 Thread ychawla
Thanks Willem,
Looks great.

-Yogesh



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Mail-CC-and-BCC-headers-tp5757943p5758097.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Camel Mail CC and BCC headers

2014-10-23 Thread ychawla
Hello All,
I recently had a production issue where there was an exception thrown when
the CC or the BCC headers were set to :

com.sun.mail.smtp.SMTPAddressFailedException: 554 5.1.1 Invalid recipient
address

Is this the expected behavior in Camel or would it be possible for camel to
check for a blank string and not attempt to set these headers when sending
the email.

Thanks,
Yogesh



--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-Mail-CC-and-BCC-headers-tp5757943.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Unable to fetch Email attachments or Multipart content using Camel-Mail in FuseESB / OSGI

2014-09-29 Thread thigales
I have created an osgi bundle with a pop3 camel route for reading mails. When
deployed in servicemix 5.1, the attachments are getting read properly as
expected.

However, the same bundle gives problem in FuseEsb-7.1.0.fuse-047-1_2013. The
contents of message available from within camel exchange(in the code snippet
below, the variable contentObject) are appearing as of type
'SharedByteArrayInputStream' rather than 'javax.mail.Multipart'.

I Have googled a lot and found posts mentioning a related problem which is
caused by javax.activation being loaded by different classloader than
javax.mail. Seems like javax.activation needs to read META-INF/mailcap from
the javamail artifact but it can't see it. Recent versions of javax.mail
seems to have fixed the MAINFEST to include mailcap, but it still seems to
occur with FuseESB.

ServiceMix configuration :

Servicemix version=5.1
Camel-mail=2.13.2
Camel-core=2.13.2
javax.mail=Java7
Javax.activation=Java7
FuseEsb configuration :

FuseESB version=7.1.0
Camel.mail=2.10.0.fuse-71-047
Camel-core=2.10.0.fuse-71-047
Javax.mail=Java7
javax.activation=Java7
Can anyone please help me to resolve this issue ? Below are the code snippet
to read the mail and the camel route. Please let me know if any further
information is required to debug the problem. Thanks.

Code snippet:

package test.mail.attachment;

import javax.mail.BodyPart;
import javax.mail.Multipart;
import javax.mail.Part;
import javax.mail.internet.MimeMessage;

import org.apache.camel.Exchange;
import org.apache.camel.Processor;

public class MyProcessor implements Processor {

 public void process(Exchange exchange) throws Exception {

  String result = null;
  javax.mail.Message message = exchange.getIn().getBody(
javax.mail.Message.class);

  if (message instanceof MimeMessage) {

   MimeMessage m = (MimeMessage) message;
   Object contentObject = m.getContent();

   if (contentObject instanceof Multipart) {

Multipart content = (Multipart) contentObject;
int count = content.getCount();

for (int i = 0; i  count; i++) {

 BodyPart part = content.getBodyPart(i);
 System.out.println(part.getContentType());

 if (part.isMimeType(text/plain)) {
  result = (String) part.getContent();
  break;
 } 
 else 
 if (part.isMimeType(text/html)) {
  result = (String) part.getContent();

 } 
 else
 if (part.isMimeType(multipart/alternative)) {

  Multipart mp = (Multipart) part.getContent();
  String text = null;

  for (int i1 = 0; i1  mp.getCount(); i1++) {

   Part bp = mp.getBodyPart(i);
   if (bp.isMimeType(text/plain)) {

if (text == null) {
 result = (String) bp.getContent();
 break;
}

   } else if (bp.isMimeType(text/html)) {
result = (String) bp.getContent();
   }
  }
 }
}
   }
   else
   if(contentObject instanceof String)  {// a simple text message
result = (String) contentObject;
   } 
   else { 
// not a mime message
// logger.log(Level.WARNING,notme part or multipart
{0},message.toString());
result = null;
   }

   System.out.println(result);
  }
 }
}
Camel Route Code

?xml version=1.0 encoding=UTF-8?
beans xmlns=http://www.springframework.org/schema/beans;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:osgi=http://www.springframework.org/schema/osgi;
 xmlns:tx=http://www.springframework.org/schema/tx;
xmlns:context=http://www.springframework.org/schema/context;
 xmlns:camel=http://camel.apache.org/schema/spring;
xmlns:util=http://www.springframework.org/schema/util;
 xsi:schemaLocation=http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
 http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
 http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd 
  http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
  http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
  http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
  http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd;

 camelContext xmlns=http://camel.apache.org/schema/spring;

  route id=mailreader
from
   
uri=pop3://mydomain?password=passwordamp;username=user1@mydomainamp;mapMailMessage=falseamp;delete=trueamp;unseen=trueamp;consumer.delay=2000
/

   log message=Transforming input file /
   process ref=myProcessor /
   to uri=log:myLog /
  /route

 /camelContext

 bean id=myProcessor class=test.mail.attachment.MyProcessor /
/beans



--
View this message in context: 
http://camel.465427.n5.nabble.com/Unable-to-fetch-Email-attachments

[camel-mail] IMAP(SSL) self-signed certificat auto accepted

2014-07-17 Thread SpinWin
Hello,

I tried to configure camel-mail to automatically accept self-signed
certificates. 
- Definition of a SoketFactory and TrustManager that verifies nothing. 
- Passage of the parameter SoketFactory my route with :
mail.imap.socketFactory.class 
(also tried with mail.imaps.socketFactory.class and
mail.imap.ssl.socketFactory.class. 

Apparently, Camel created the route but at first pooling camel throw an
exception that says it seeks the certificate. 
(I think it uses the socket factory default and not mine). 

An idea ... please help me ! 

Thanks a lot.





--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-mail-IMAP-SSL-self-signed-certificat-auto-accepted-tp5753981.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel mail: content-transfer-encoding configurable

2014-06-25 Thread cgiera
Ticket created, see https://issues.apache.org/jira/browse/CAMEL-7536.
Looking forward to provide a patch.

kind regards,
Christoph



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-mail-content-transfer-encoding-configurable-tp5752504p5752791.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel mail: content-transfer-encoding configurable

2014-06-24 Thread cgiera
Hi,

ok, just for clarification what would be a good solution for this:
I've not mentioned that we need the content-transfer-encoding for the
attachments of the mail.

Some ideas from my side:
1. use a parameter like contentType, let's say content-transfer-encoding:
If this parameter is set ALL attachments will have this
content-transfer-encoding.
The problem I see here is that it's probably a bit misleading as the
contentType parameter affects the mailbody and content-transfer-encoding the
attachments. Maybe this issue could be solved by renaming the parameter to
something like attachment-transfer-encoding

2. when an attachment will be added to the exchange object the contentType
could be defined like this:
 
In the org.apache.camel.component.mail.MailBinding class then we extract the
content transfer encoding, for example:


Maybe we discuss the possible solutions before I start patching.

kind regards,
Christoph



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-mail-content-transfer-encoding-configurable-tp5752504p5752738.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel mail: content-transfer-encoding configurable

2014-06-24 Thread cgiera
Maybe something similar to the ContentTypeResolver is also a good solution



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-mail-content-transfer-encoding-configurable-tp5752504p5752744.html
Sent from the Camel - Users mailing list archive at Nabble.com.


camel mail: content-transfer-encoding configurable

2014-06-18 Thread cgiera
Hello,

the camel mail componente determines the content-transfer-encoding itself
based on the content of the message.
We now have a customer we are only allowed to send messages where the
content-transfer-encoding is base64. As most of the messages haven't any
special characters camel determines 7bit or quoted-printable as
content-transfer-encoding and we are not able to manipulate that.

I wanted to discuss if content-transfer-encoding would be a viable uri
option(like contentType) for the future.
If so, I would create a ticket and try my best to provide a patch for this.

kind regards,
Christoph



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-mail-content-transfer-encoding-configurable-tp5752504.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel mail: content-transfer-encoding configurable

2014-06-18 Thread Claus Ibsen
Hi

You are welcome. We love contributions.
http://camel.apache.org/support

If you could make this optional, so you need to turn this on so it
wont affect existing users. Then that would be the best imho.


On Wed, Jun 18, 2014 at 3:15 PM, cgiera christoph.gi...@mic-cust.com wrote:
 Hello,

 the camel mail componente determines the content-transfer-encoding itself
 based on the content of the message.
 We now have a customer we are only allowed to send messages where the
 content-transfer-encoding is base64. As most of the messages haven't any
 special characters camel determines 7bit or quoted-printable as
 content-transfer-encoding and we are not able to manipulate that.

 I wanted to discuss if content-transfer-encoding would be a viable uri
 option(like contentType) for the future.
 If so, I would create a ticket and try my best to provide a patch for this.

 kind regards,
 Christoph



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/camel-mail-content-transfer-encoding-configurable-tp5752504.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


camel-mail and camel-cxf incompatible?

2014-04-20 Thread bocamel
I am having a problem with a camel project that uses both camel-mail and
camel-cxf.  If only camel-mail is used, it can successfully consume emails
from an IMAP endpoint.  But if camel-cxf maven dependency is included, even
if there is no cxfendpoint route defined in Camel Context, the IMAP consumer
would not consume emails if mapMailMessage is set to false.  If
mapMailMessage is set to true, the IMAP consumer does consume emails, but I
get the null exchange exception because the emails may be multipart
messages.  When the IMAP consumer does not consume, there is no error
message in the log.  I am running Camel 2.13.0 and
cxf-rt-transports-http-jetty 2.7.10.  Any help would be greatly appreciated.
Another strange thing is that the application would work fine when running
under Eclipse.

Here is my camel-context:

?xml version=1.0 encoding=UTF-8?


beans xmlns=http://www.springframework.org/schema/beans;
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
   xmlns:camel=http://camel.apache.org/schema/spring;
   xsi:schemaLocation=
   http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
   http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd;

bean id=myProc class=com.pci.TestImapConsumer.MailProc /
bean id=myGroovyProc class=com.pci.TestImapConsumer.GroovyMailProc /

  camel:camelContext xmlns=http://camel.apache.org/schema/spring;
camel:route
  camel:from
uri=imaps://imap.gmail.com:993?username=t...@e-bonding.comamp;password=partners2014amp;delete=trueamp;mapMailMessage=falseamp;closeFolder=falseamp;disconnect=false/
  camel:log message=* Email received from IMAP. /
  camel:process ref=myGroovyProc /
/camel:route
  /camel:camelContext

/beans




--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-mail-and-camel-cxf-incompatible-tp5750386.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-mail and camel-cxf incompatible?

2014-04-20 Thread Willem Jiang
It looks like there some conflict between the java mail jar and 
geronimo-javamail_1.4_spec.jar.
Can you try to exclude the 
org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1 just below the 
dependency of cxf-rt-transports-http-jetty.


--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On April 21, 2014 at 2:27:24 AM, bocamel (johnz...@gmail.com) wrote:
 I am having a problem with a camel project that uses both camel-mail and
 camel-cxf. If only camel-mail is used, it can successfully consume emails
 from an IMAP endpoint. But if camel-cxf maven dependency is included, even
 if there is no cxfendpoint route defined in Camel Context, the IMAP consumer
 would not consume emails if mapMailMessage is set to false. If
 mapMailMessage is set to true, the IMAP consumer does consume emails, but I
 get the null exchange exception because the emails may be multipart
 messages. When the IMAP consumer does not consume, there is no error
 message in the log. I am running Camel 2.13.0 and
 cxf-rt-transports-http-jetty 2.7.10. Any help would be greatly appreciated.
 Another strange thing is that the application would work fine when running
 under Eclipse.
  
 Here is my camel-context:
  
  
  
  
  xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:camel=http://camel.apache.org/schema/spring;
 xsi:schemaLocation=
 http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans.xsd
 http://camel.apache.org/schema/spring
 http://camel.apache.org/schema/spring/camel-spring.xsd;
  
  
  
  
  
  
  uri=imaps://imap.gmail.com:993?username=t...@e-bonding.compassword=partners2014delete=truemapMailMessage=falsecloseFolder=falsedisconnect=false/

  
  
  
  
  
  
  
  
  
  
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/camel-mail-and-camel-cxf-incompatible-tp5750386.html
   
 Sent from the Camel - Users mailing list archive at Nabble.com.
  



Re: camel-mail and camel-cxf incompatible?

2014-04-20 Thread bocamel
Willem,  thank you very much for the quick response!  Your suggestion worked
perfectly.



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-mail-and-camel-cxf-incompatible-tp5750386p5750393.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Edit the attachement content using camel mail

2014-04-10 Thread karthik
Hi Team,

Is there any way possible that we can edit the attachment content on the way
using camel api.
I am facing an issue where additional junk characters are getting introduced
in the attachement due to which i am getting an getting an exception like
this.
com.sun.mail.util.DecodingException: BASE64Decoder: Error in encoded stream:
needed at least 2 valid base64 characters, but only got 0 before padding.
I am using IMAP protocol and tried using the
props.setProperty(mail.imaps.partialfetch, false) but it did not work.
I am able to get the data using the following statement and want to ignore
some special characters that are getting inserted additionally.

   // get the content and convert it to byte[]
  byte[] data =
exchange.getContext().getTypeConverter().convertTo(byte[].class,
dh.getInputStream());

Any help or pointers would be of great help..

Thanks in advance.

Regards,
Karthik.



--
View this message in context: 
http://camel.465427.n5.nabble.com/Edit-the-attachement-content-using-camel-mail-tp5750048.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: error blocking camel-mail consumer

2014-04-09 Thread Claus Ibsen
On Tue, Apr 8, 2014 at 2:02 PM,  stefan@zv-extern.fraunhofer.de wrote:
 Hello,

 You can try with mapMailMessage=false, and then use Camel's error
 handler if parsing the body / attachments of the mail fails.
 this would only prevent this special error, but perhaps there will others 
 rise in the future.

 Though there was a bug in Camel when using mapMailMessage=false. You
 may need to use next release of Camel and/or latest release if the bug
 was fixed in that release.
 I worked around that and changed MailMessage in the constructor and 
 setMessage to prevent this exception (see below), because I couldn't wait for 
 the fix. But again this also only prevents this special exception, not others.

 An alternative is to add functionality to the mail component to deal
 with parsing errors before routing, such as mark it as seen or move it
 etc.
 This would be great. How can I do that (I'm quite new to camel) or is this a 
 new feature in a coming version?


Its not so easy but you would need to add functionality to deal with
this in the mail consumer class
https://github.com/apache/camel/blob/master/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConsumer.java

You are also welcome to log a JIRA ticket with this enhancement, then
we wont forget. And likely add such in a future release.

 Best regards,
 Stefan Hof

 -Ursprüngliche Nachricht-
 Von: Claus Ibsen [mailto:claus.ib...@gmail.com]
 Gesendet: Dienstag, 8. April 2014 10:58
 An: users@camel.apache.org
 Betreff: Re: error blocking camel-mail consumer

 Hi

 You can try with mapMailMessage=false, and then use Camel's error
 handler if parsing the body / attachments of the mail fails.

 Though there was a bug in Camel when using mapMailMessage=false. You
 may need to use next release of Camel and/or latest release if the bug
 was fixed in that release.

 An alternative is to add functionality to the mail component to deal
 with parsing errors before routing, such as mark it as seen or move it
 etc.

 On Mon, Apr 7, 2014 at 5:27 PM,  stefan@zv-extern.fraunhofer.de
 wrote:
  Hello,
 
  if I use the mail-component for polling emails and there is an error while
 consuming the mail, how can I skip this mail and move to the next?
 
  For example:
 
 from(imaps://{{email.server}}?username={{email.username}}password=R
 AW({{email.password}})
   + delete=truecopyTo={{email.folder}}/doneunseen=true
 folderName={{email.folder}}
   + fetchSize=1contentType=text/html)
  moves the processed mail in the done-subfolder of the email-folder, if
 everything is ok, eg, the route finishes.
 
  But if the mail-consumer hits an error _before_ the route starts, the error
 will be logged and nothing more happens. This means, the processed mail
 remains unchanged in in the email-folder and will be the next polled email,
 that leads to the same error, where the error will be logged and...
 
  How can I break this endless circle an mark the email as (unsuccessfully)
 processed, so that it will not be read again?
 
  Best regards,
  Stefan Hof
 
 --
 Claus Ibsen
 -
 Red Hat, Inc.
 Email: cib...@redhat.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen
 Make your Camel applications look hawt, try: http://hawt.io

 my changes in org.apache.camel.component.mail.MailMessage:
 Constructor:

 public MailMessage(Message message) {
 this.originalMailMessage = this.mailMessage = message;
 // --- insert -
 // Workaround for server-bugs like unable to load bodystructure
 // see:
 // 
 http://www.oracle.com/technetwork/java/faq-135477.html#imapserverbug
 // Use the MimeMessage copy constructor to make a copy
 // of the entire message, which will fetch the entire
 // message from the server and parse it on the client:
 if (message instanceof MimeMessage) {
 try {
 this.mailMessage = new MimeMessage((MimeMessage) message);
 } catch (MessagingException e) {
 // do nothing, it's a workaround
 }
 }
 // --- end insert -
 }

 setMessage:

 public void setMessage(Message mailMessage) {
 if (this.originalMailMessage == null) {
 this.originalMailMessage = mailMessage;
 }
 this.mailMessage = mailMessage;
 // --- insert -
 // Workaround for server-bugs like unable to load bodystructure
 // see:
 // 
 http://www.oracle.com/technetwork/java/faq-135477.html#imapserverbug
 // Use the MimeMessage copy constructor to make a copy
 // of the entire message, which will fetch the entire
 // message from the server and parse it on the client:
 if (mailMessage.getMessageNumber()  0 // not necessary, if new or 
 already a copy

Re: error blocking camel-mail consumer

2014-04-08 Thread Claus Ibsen
Hi

You can try with mapMailMessage=false, and then use Camel's error
handler if parsing the body / attachments of the mail fails.

Though there was a bug in Camel when using mapMailMessage=false. You
may need to use next release of Camel and/or latest release if the bug
was fixed in that release.

An alternative is to add functionality to the mail component to deal
with parsing errors before routing, such as mark it as seen or move it
etc.

On Mon, Apr 7, 2014 at 5:27 PM,  stefan@zv-extern.fraunhofer.de wrote:
 Hello,

 if I use the mail-component for polling emails and there is an error while 
 consuming the mail, how can I skip this mail and move to the next?

 For example:
   
 from(imaps://{{email.server}}?username={{email.username}}password=RAW({{email.password}})
  + delete=truecopyTo={{email.folder}}/doneunseen=true 
 folderName={{email.folder}}
  + fetchSize=1contentType=text/html)
 moves the processed mail in the done-subfolder of the email-folder, if 
 everything is ok, eg, the route finishes.

 But if the mail-consumer hits an error _before_ the route starts, the error 
 will be logged and nothing more happens. This means, the processed mail 
 remains unchanged in in the email-folder and will be the next polled email, 
 that leads to the same error, where the error will be logged and...

 How can I break this endless circle an mark the email as (unsuccessfully) 
 processed, so that it will not be read again?

 Best regards,
 Stefan Hof




-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io


AW: error blocking camel-mail consumer

2014-04-08 Thread stefan.hof
Hello,

 You can try with mapMailMessage=false, and then use Camel's error
 handler if parsing the body / attachments of the mail fails.
this would only prevent this special error, but perhaps there will others rise 
in the future.

 Though there was a bug in Camel when using mapMailMessage=false. You
 may need to use next release of Camel and/or latest release if the bug
 was fixed in that release.
I worked around that and changed MailMessage in the constructor and setMessage 
to prevent this exception (see below), because I couldn't wait for the fix. But 
again this also only prevents this special exception, not others.

 An alternative is to add functionality to the mail component to deal
 with parsing errors before routing, such as mark it as seen or move it
 etc.
This would be great. How can I do that (I'm quite new to camel) or is this a 
new feature in a coming version?

Best regards,
Stefan Hof

 -Ursprüngliche Nachricht-
 Von: Claus Ibsen [mailto:claus.ib...@gmail.com]
 Gesendet: Dienstag, 8. April 2014 10:58
 An: users@camel.apache.org
 Betreff: Re: error blocking camel-mail consumer
 
 Hi
 
 You can try with mapMailMessage=false, and then use Camel's error
 handler if parsing the body / attachments of the mail fails.
 
 Though there was a bug in Camel when using mapMailMessage=false. You
 may need to use next release of Camel and/or latest release if the bug
 was fixed in that release.
 
 An alternative is to add functionality to the mail component to deal
 with parsing errors before routing, such as mark it as seen or move it
 etc.
 
 On Mon, Apr 7, 2014 at 5:27 PM,  stefan@zv-extern.fraunhofer.de
 wrote:
  Hello,
 
  if I use the mail-component for polling emails and there is an error while
 consuming the mail, how can I skip this mail and move to the next?
 
  For example:
 
 from(imaps://{{email.server}}?username={{email.username}}password=R
 AW({{email.password}})
   + delete=truecopyTo={{email.folder}}/doneunseen=true
 folderName={{email.folder}}
   + fetchSize=1contentType=text/html)
  moves the processed mail in the done-subfolder of the email-folder, if
 everything is ok, eg, the route finishes.
 
  But if the mail-consumer hits an error _before_ the route starts, the error
 will be logged and nothing more happens. This means, the processed mail
 remains unchanged in in the email-folder and will be the next polled email,
 that leads to the same error, where the error will be logged and...
 
  How can I break this endless circle an mark the email as (unsuccessfully)
 processed, so that it will not be read again?
 
  Best regards,
  Stefan Hof
 
 --
 Claus Ibsen
 -
 Red Hat, Inc.
 Email: cib...@redhat.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen
 Make your Camel applications look hawt, try: http://hawt.io

my changes in org.apache.camel.component.mail.MailMessage:
Constructor:

public MailMessage(Message message) {
this.originalMailMessage = this.mailMessage = message;
// --- insert -
// Workaround for server-bugs like unable to load bodystructure
// see:
// http://www.oracle.com/technetwork/java/faq-135477.html#imapserverbug
// Use the MimeMessage copy constructor to make a copy
// of the entire message, which will fetch the entire
// message from the server and parse it on the client:
if (message instanceof MimeMessage) {
try {
this.mailMessage = new MimeMessage((MimeMessage) message);
} catch (MessagingException e) {
// do nothing, it's a workaround
}
}
// --- end insert -
}

setMessage:

public void setMessage(Message mailMessage) {
if (this.originalMailMessage == null) {
this.originalMailMessage = mailMessage;
}
this.mailMessage = mailMessage;
// --- insert -
// Workaround for server-bugs like unable to load bodystructure
// see:
// http://www.oracle.com/technetwork/java/faq-135477.html#imapserverbug
// Use the MimeMessage copy constructor to make a copy
// of the entire message, which will fetch the entire
// message from the server and parse it on the client:
if (mailMessage.getMessageNumber()  0 // not necessary, if new or 
already a copy
 mailMessage instanceof MimeMessage) {
try {
this.mailMessage = new MimeMessage((MimeMessage) mailMessage);
} catch (MessagingException e) {
// do nothing, it's a workaround
}
}
// --- end insert -
}


error blocking camel-mail consumer

2014-04-07 Thread stefan.hof
Hello,

if I use the mail-component for polling emails and there is an error while 
consuming the mail, how can I skip this mail and move to the next?

For example:
  
from(imaps://{{email.server}}?username={{email.username}}password=RAW({{email.password}})
 + delete=truecopyTo={{email.folder}}/doneunseen=true 
folderName={{email.folder}}
 + fetchSize=1contentType=text/html)
moves the processed mail in the done-subfolder of the email-folder, if 
everything is ok, eg, the route finishes.

But if the mail-consumer hits an error _before_ the route starts, the error 
will be logged and nothing more happens. This means, the processed mail remains 
unchanged in in the email-folder and will be the next polled email, that leads 
to the same error, where the error will be logged and...

How can I break this endless circle an mark the email as (unsuccessfully) 
processed, so that it will not be read again?

Best regards, 
Stefan Hof



Re: Error with Apache Camel Mail unseen flag

2013-06-27 Thread Claus Ibsen
Hi

You need to add searchTerm.unseen=false to configure this option when
using searchTerm as the regular unseen option is not used.



On Thu, Jun 27, 2013 at 12:13 AM, Mangiameli, Josiah
josiah.mangiam...@urjanet.com wrote:
 I use the exact same route and the only thing that I change is I go
 manually change some of the messages that meet the criteria to un-read (in
 my email inbox). That is the difference between the exchange coming back
 null or coming back with an email message.

 Is there another way to ensure that the emails read/undread status have no
 affect?

 Josiah


 On Wed, Jun 26, 2013 at 7:52 AM, Claus Ibsen claus.ib...@gmail.com wrote:

 Maybe the search terms is wrong.


 On Wed, Jun 26, 2013 at 2:28 AM, Mangiameli, Josiah
 josiah.mangiam...@urjanet.com wrote:
  All,
 
  I am having an issue where even when I have set the unseen flag to false
 in
  my camel mail route, it is unable to find the unread message.
  When I go manually change the message to unread in my mail client, the
  exact same route is able to find the message.
 
  I should mention that I am using the ConsumerTemplate to receive the
  endpoint.
 
  Here is the camel route I am using
 
  imaps://
 
 imap.gmail.com?username=USERpassword=PASSmapMailMessage=falsesearchTerm.from=FROMsearchTerm.fromSentDate=2013-03-2507:56:02connectionTimeout=15000unseen=falsefolderName=INBOX
 ;
 
 
  Is this a known bug or is there an issue with the route I am using?
 
 
  Regards,
  --
  Josiah Mangiameli
 
  Software Developer
  Urjanet Energy Solutions



 --
 Claus Ibsen
 -
 www.camelone.org: The open source integration conference.

 Red Hat, Inc.
 FuseSource is now part of Red Hat
 Email: cib...@redhat.com
 Web: http://fusesource.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen




 --
 Josiah Mangiameli

 Software Developer
 Urjanet Energy Solutions



-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Error with Apache Camel Mail unseen flag

2013-06-26 Thread Claus Ibsen
Maybe the search terms is wrong.


On Wed, Jun 26, 2013 at 2:28 AM, Mangiameli, Josiah
josiah.mangiam...@urjanet.com wrote:
 All,

 I am having an issue where even when I have set the unseen flag to false in
 my camel mail route, it is unable to find the unread message.
 When I go manually change the message to unread in my mail client, the
 exact same route is able to find the message.

 I should mention that I am using the ConsumerTemplate to receive the
 endpoint.

 Here is the camel route I am using

 imaps://
 imap.gmail.com?username=USERpassword=PASSmapMailMessage=falsesearchTerm.from=FROMsearchTerm.fromSentDate=2013-03-2507:56:02connectionTimeout=15000unseen=falsefolderName=INBOX;


 Is this a known bug or is there an issue with the route I am using?


 Regards,
 --
 Josiah Mangiameli

 Software Developer
 Urjanet Energy Solutions



-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Error with Apache Camel Mail unseen flag

2013-06-26 Thread Mangiameli, Josiah
I use the exact same route and the only thing that I change is I go
manually change some of the messages that meet the criteria to un-read (in
my email inbox). That is the difference between the exchange coming back
null or coming back with an email message.

Is there another way to ensure that the emails read/undread status have no
affect?

Josiah


On Wed, Jun 26, 2013 at 7:52 AM, Claus Ibsen claus.ib...@gmail.com wrote:

 Maybe the search terms is wrong.


 On Wed, Jun 26, 2013 at 2:28 AM, Mangiameli, Josiah
 josiah.mangiam...@urjanet.com wrote:
  All,
 
  I am having an issue where even when I have set the unseen flag to false
 in
  my camel mail route, it is unable to find the unread message.
  When I go manually change the message to unread in my mail client, the
  exact same route is able to find the message.
 
  I should mention that I am using the ConsumerTemplate to receive the
  endpoint.
 
  Here is the camel route I am using
 
  imaps://
 
 imap.gmail.com?username=USERpassword=PASSmapMailMessage=falsesearchTerm.from=FROMsearchTerm.fromSentDate=2013-03-2507:56:02connectionTimeout=15000unseen=falsefolderName=INBOX
 ;
 
 
  Is this a known bug or is there an issue with the route I am using?
 
 
  Regards,
  --
  Josiah Mangiameli
 
  Software Developer
  Urjanet Energy Solutions



 --
 Claus Ibsen
 -
 www.camelone.org: The open source integration conference.

 Red Hat, Inc.
 FuseSource is now part of Red Hat
 Email: cib...@redhat.com
 Web: http://fusesource.com
 Twitter: davsclaus
 Blog: http://davsclaus.com
 Author of Camel in Action: http://www.manning.com/ibsen




-- 
Josiah Mangiameli

Software Developer
Urjanet Energy Solutions


Error with Apache Camel Mail unseen flag

2013-06-25 Thread Mangiameli, Josiah
All,

I am having an issue where even when I have set the unseen flag to false in
my camel mail route, it is unable to find the unread message.
When I go manually change the message to unread in my mail client, the
exact same route is able to find the message.

I should mention that I am using the ConsumerTemplate to receive the
endpoint.

Here is the camel route I am using

imaps://
imap.gmail.com?username=USERpassword=PASSmapMailMessage=falsesearchTerm.from=FROMsearchTerm.fromSentDate=2013-03-2507:56:02connectionTimeout=15000unseen=falsefolderName=INBOX;


Is this a known bug or is there an issue with the route I am using?


Regards,
-- 
Josiah Mangiameli

Software Developer
Urjanet Energy Solutions


Re: camel-mail

2013-05-20 Thread nickerox
It works adding to property. Many thx



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-mail-tp5725119p5732817.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-mail

2013-05-19 Thread nickerox
Hi Claus,

I`m testing this simple java code:

CamelContext ctx = new DefaultCamelContext();

ctx.addRoutes(new RouteBuilder() {

@Override
public void configure() throws Exception {

from(direct:mail).
 setHeader(subject, constant(Apache camel 
test))
.setHeader(From, constant(t...@virgilio.it))

.to(smtp://usern...@virgilio.it?password=);
}
});

ctx.start();

Endpoint endpoint = ctx.getEndpoint(direct:mail);

ProducerTemplate p = new DefaultProducerTemplate(ctx, endpoint);
p.start();
p.sendBody(Hello!);
System.out.println(Sent!);
p.stop();
ctx.stop(); 


receiving this response: Could not connect to SMTP host: virgilio.it, port:
25 (right, because SMTP server is out.virgilio.it);
If i substitute the endpoint with 
smtp://usern...@out.virgilio.it?password=
 I get the right AddressFailedException.
So, please, could you help me to understand my error or if i have missed any
properties?
Thx in advance




--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-mail-tp5725119p5732800.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-mail

2013-05-19 Thread Claus Ibsen
Hi

If you see any exception then that may have details that can lead you
to what is wrong etc. And make sure your username and password is
correct.

Also you need to set a header with the to eg with the email to who
is to receive the email.
setHeader(to, constant(some...@somewhere.com))



On Sat, May 18, 2013 at 7:04 PM, nickerox mandrakeli...@tiscali.it wrote:
 Hi Claus,

 I`m testing this simple java code:

 CamelContext ctx = new DefaultCamelContext();

 ctx.addRoutes(new RouteBuilder() {

 @Override
 public void configure() throws Exception {

 from(direct:mail).
  setHeader(subject, constant(Apache camel 
 test))
 .setHeader(From, 
 constant(t...@virgilio.it))
 
 .to(smtp://usern...@virgilio.it?password=);
 }
 });

 ctx.start();

 Endpoint endpoint = ctx.getEndpoint(direct:mail);

 ProducerTemplate p = new DefaultProducerTemplate(ctx, 
 endpoint);
 p.start();
 p.sendBody(Hello!);
 System.out.println(Sent!);
 p.stop();
 ctx.stop();


 receiving this response: Could not connect to SMTP host: virgilio.it, port:
 25 (right, because SMTP server is out.virgilio.it);
 If i substitute the endpoint with
 smtp://usern...@out.virgilio.it?password=
  I get the right AddressFailedException.
 So, please, could you help me to understand my error or if i have missed any
 properties?
 Thx in advance




 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/camel-mail-tp5725119p5732800.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Problems with Camel Mail (IMAP) Attachments and JBoss

2013-05-13 Thread Claus Ibsen
Hi

How do you deploy your application to JBoss 7?

If you have a WAR then maybe the problem is that you have java mail
and attachments api JARs in the WEB-INF/lib directory which conflicts
with what JBoss has out of the box. Or vice-versa.



On Tue, May 7, 2013 at 2:30 PM, b.fischer b.fisc...@hsag.info wrote:
 Hi!
 I hope someone can help me with a Problem with Camel Mail and JBoss 7.
 I want to get the attachments from Mails of a IMAP Mailbox.
 The connect and retrieval of the messages works correct, but the exchange
 objects in my processor has no Attachments in JBoss. When I call the
 hasAttachments method from the exchange.getIn, it returns always false.
 Strangly I test the application in a Tomcat. There works everthing fine and
 I get the attachments with no problems (the hasAttachments method returns
 true with tomcat).
 Is there maybe a special import that I need for JBoss?

 Thanks!
 BF





 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Problems-with-Camel-Mail-IMAP-Attachments-and-JBoss-tp5732120.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Problems with Camel Mail (IMAP) Attachments and JBoss

2013-05-07 Thread b.fischer
Hi!
I hope someone can help me with a Problem with Camel Mail and JBoss 7.
I want to get the attachments from Mails of a IMAP Mailbox.
The connect and retrieval of the messages works correct, but the exchange
objects in my processor has no Attachments in JBoss. When I call the
hasAttachments method from the exchange.getIn, it returns always false.
Strangly I test the application in a Tomcat. There works everthing fine and
I get the attachments with no problems (the hasAttachments method returns
true with tomcat).
Is there maybe a special import that I need for JBoss?

Thanks!
BF





--
View this message in context: 
http://camel.465427.n5.nabble.com/Problems-with-Camel-Mail-IMAP-Attachments-and-JBoss-tp5732120.html
Sent from the Camel - Users mailing list archive at Nabble.com.


  1   2   3   >