Hi Isuru,

You have identified the root cause correctly.

All Gmail message reading operations use the same IMAPStore instance which
is created during the initial authentication with the connector. So, as u
said, due to the parallel invocation of "gmail.readMailMessage" operation,
the "[Gmail]/All Mail"  folder in the IMAPStore will be opened and closed
in parallel runs.

To get rid of this, you can make the ESB iterator sequential, using;

                     sequential="true"

in your iterator configuration.

Thanks,
Sewwandi


On Thu, May 29, 2014 at 10:13 PM, Isuru Ranawaka <isu...@wso2.com> wrote:

> Hi sewwandi,
>
> Files are attached.
>
> thanks
> isurur
>
>
> On Thu, May 29, 2014 at 10:08 PM, Sewwandi Perera <sewwa...@wso2.com>
> wrote:
>
>> Hi Isuru,
>>
>> Can you please attach your ESB configuration here.
>>
>> Thanks,
>>
>>
>> On Thu, May 29, 2014 at 8:10 PM, Isuru Ranawaka <isu...@wso2.com> wrote:
>>
>>> Hi all,
>>>
>>>  When invoking ReadMailMessage operation in GmailConnector in a
>>> loop.After reading few messages it starts to give following error.
>>>
>>>
>>> INFO - GmailReadMailMessage Loading the IMAPStore
>>> [2014-05-29 19:48:42,838]  INFO - GmailIMAPClientLoader Retriving the
>>> prestored IMAPstore instance
>>> [2014-05-29 19:48:42,839]  INFO - GmailUtils Started reading messages
>>> [2014-05-29 19:48:44,923] ERROR - GmailUtils Failure while fetching
>>> messages
>>> [2014-05-29 19:48:44,923]  INFO - GmailUtils Stored the error response
>>> [2014-05-29 19:48:44,923] ERROR - GmailReadMailMessage connection failure
>>> com.google.code.javax.mail.MessagingException: connection failure
>>>     at
>>> com.google.code.com.sun.mail.imap.IMAPStore.getProtocol(IMAPStore.java:844)
>>>     at
>>> com.google.code.com.sun.mail.imap.IMAPFolder.open(IMAPFolder.java:959)
>>>     at
>>> org.wso2.carbon.connector.gmail.GmailUtils.readMails(GmailUtils.java:238)
>>>     at
>>> org.wso2.carbon.connector.gmail.GmailReadMailMessage.connect(GmailReadMailMessage.java:61)
>>>     at
>>> org.wso2.carbon.connector.core.AbstractConnector.mediate(AbstractConnector.java:32)
>>>     at
>>> org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:78)
>>>     at
>>> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
>>>     at
>>> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
>>>     at
>>> org.apache.synapse.mediators.template.TemplateMediator.mediate(TemplateMediator.java:77)
>>>     at
>>> org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:129)
>>>     at
>>> org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:78)
>>>     at
>>> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
>>>     at
>>> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
>>>     at
>>> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
>>>     at
>>> org.apache.synapse.mediators.MediatorWorker.run(MediatorWorker.java:69)
>>>     at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>>     at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>>>     at java.lang.Thread.run(Thread.java:662
>>>
>>>
>>> According to the implementation
>>>
>>> In GmailUtils inside readMails method,  it fetches the AllMails folder
>>> and open and close it for and every each message.Since it  runs in a loop
>>> there is a possibility to open the folder before close.Is this can be the
>>> Issue or something else.
>>>
>>>
>>> thanks,
>>> isurur
>>>
>>>
>>>
>>> --
>>> Regards
>>> Isuru Ranawaka
>>> phone :- +94714629880
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Sewwandi Perera
>> Software Engineer
>>
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>>
>
>
>
> --
> Regards
> Isuru Ranawaka
> phone :- +94714629880
>



-- 
Sewwandi Perera
Software Engineer

WSO2 Inc.; http://wso2.com
lean.enterprise.middleware
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to