Hi,
I have a ConsumeIMAP processor downloading emails from office 365 mailbox using StandardOAuth2AccessTokenProvider.
Here is a simple structure, consisting of few processors, including custom one. When testing various scenarios I also removed my custom processor to make sure my problem is not caused by this.
The thing is, that when testing and starting ConnsumeIMAP via "run once" option, it works perfectly and it gives me my 10 emails as set in Fetch Size.
But when I start processor using Start option so it uses cron frequency 2 minutes, it returns only one email and the rest only when I stop the ConsumeIMAP processor. I tried to schedule to 5, 10, 15 minutes, but without effect. Also tried for accesstokenprovider processor various setting in refresh window property from 0 s to 60 s, but also without any effect.
Also, after some time, and only sometimes, I get Authentization fail error, see below. When I stop the processor and use "run once", it starts to work immediately as I already mentioned above.
Asked IT to check logs on exchange server, but there is nothing.
I'm a bit desperate by now, as I googled, chatgpted a lot, so you guy are my last chance before I get mad.
Thanks for all suggestions you might have.
![Luwi_0-1701929141451.png Luwi_0-1701929141451.png](https://community.cloudera.com/t5/image/serverpage/image-id/39133i024DB603C554319B/image-size/medium?v=v2&px=400)
Here are parameters of ConsumeIMAP and StandardOAuth2AccessTokenProvider:
![Luwi_1-1701929223245.png Luwi_1-1701929223245.png](https://community.cloudera.com/t5/image/serverpage/image-id/39134i877230E20391B116/image-size/medium?v=v2&px=400)
![Luwi_2-1701929236554.png Luwi_2-1701929236554.png](https://community.cloudera.com/t5/image/serverpage/image-id/39135iE7ED1453206F2630/image-size/medium?v=v2&px=400)
org.apache.nifi.processor.exception.ProcessException: Failed to receive messages from Email server: [javax.mail.AuthenticationFailedException - AUTHENTICATE failed. at org.apache.nifi.processors.email.AbstractEmailProcessor.fillMessageQueueIfNecessary(AbstractEmailProcessor.java:386) at org.apache.nifi.processors.email.AbstractEmailProcessor.receiveMessage(AbstractEmailProcessor.java:439) at org.apache.nifi.processors.email.AbstractEmailProcessor.onTrigger(AbstractEmailProcessor.java:242) at org.apache.nifi.processors.email.ConsumeIMAP.onTrigger(ConsumeIMAP.java:32) at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27) at org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1361) at org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:247) at org.apache.nifi.controller.scheduling.QuartzSchedulingAgent$2.run(QuartzSchedulingAgent.java:130) at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750) Caused by: javax.mail.AuthenticationFailedException: AUTHENTICATE failed. at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:732) at javax.mail.Service.connect(Service.java:366) at javax.mail.Service.connect(Service.java:246) at javax.mail.Service.connect(Service.java:195) at org.springframework.integration.mail.AbstractMailReceiver.connectStoreIfNecessary(AbstractMailReceiver.java:334) at org.springframework.integration.mail.AbstractMailReceiver.openFolder(AbstractMailReceiver.java:345) at org.springframework.integration.mail.AbstractMailReceiver.receive(AbstractMailReceiver.java:373) at org.apache.nifi.processors.email.AbstractEmailProcessor.fillMessageQueueIfNecessary(AbstractEmailProcessor.java:381)