How to setup Exchange Listener in Docker

Hello

I'm deploying Creatio Exchange Listener for my developing environment. 

I'm following this academy guide:

https://academy.creatio.com/documents/administration/7-16/deploying-synchronization-service-docker?document=administration#CSH_4

I got this error message when I created the listener container:

PS C:\Users\medouederni-pc> docker run -p 8808:80 --env ExchangeListenerRedisHost=172.17.0.2 --env ExchangeListenerRedisDatabase=0 --env PodName=CreatioExchangeListener  --name CreatioExchangeListener bpmonline/exchangelistener:0.5.0                                                                                                                               Unable to find image 'bpmonline/exchangelistener:0.5.0' locally
0.5.0: Pulling from bpmonline/exchangelistener
804555ee0376: Pull complete                                                                                                                                                         970251047358: Pull complete                                                                                                                                                         f3d4c41a4fd1: Pull complete                                                                                                                                                         1cccda79a5f9: Pull complete                                                                                                                                                         a02b6037fa5e: Pull complete                                                                                                                                                         5a51c6fa0bad: Pull complete                                                                                                                                                         Digest: sha256:bb4e356161faade8783fbb86a820f96b837222a11dce7311617b4236777c49c4
Status: Downloaded newer image for bpmonline/exchangelistener:0.5.0
log4net:ERROR Could not create Appender [ExchangeListenerGelfAmqpAppender] of type [Gelf4Net.Appender.GelfAmqpAppender, Gelf4Net.AmqpAppender]. Reported error follows.
RabbitMQ.Client.Exceptions.BrokerUnreachableException: None of the specified endpoints were reachable ---> RabbitMQ.Client.Exceptions.ConnectFailureException: Connection failed ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException: No such device or address
   at System.Net.Dns.InternalGetHostByName(String hostName)
   at System.Net.Dns.ResolveCallback(Object context)
--- End of stack trace from previous location where exception was thrown ---
   at System.Net.Dns.HostResolutionEndHelper(IAsyncResult asyncResult)
   at System.Net.Dns.EndGetHostAddresses(IAsyncResult asyncResult)
   at System.Net.Dns.<>c.<GetHostAddressesAsync>b__25_1(IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
   at RabbitMQ.Client.TcpClientAdapter.ConnectAsync(String host, Int32 port)
   at RabbitMQ.Client.Impl.TaskExtensions.TimeoutAfter(Task task, Int32 millisecondsTimeout)
   at RabbitMQ.Client.Impl.SocketFrameHandler.Connect(ITcpClient socket, AmqpTcpEndpoint endpoint, Int32 timeout)
   --- End of inner exception stack trace ---
   at RabbitMQ.Client.EndpointResolverExtensions.SelectOne[T](IEndpointResolver resolver, Func`2 selector)
   at RabbitMQ.Client.Framing.Impl.AutorecoveringConnection.Init(IEndpointResolver endpoints)
   at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName)
   --- End of inner exception stack trace ---
   at RabbitMQ.Client.ConnectionFactory.CreateConnection(IEndpointResolver endpointResolver, String clientProvidedName)
   at Gelf4Net.Appender.GelfAmqpAppender.InitializeConnectionFactory()
   at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender(XmlElement appenderElement)
log4net:ERROR Appender named [ExchangeListenerGelfAmqpAppender] not found.
Hosting environment: Production
Content root path: /app
Now listening on: http://[::]:80
Application started. Press Ctrl+C to shut down.

 

I tested the service and its working:

{
  "ServiceStatus": "Started",
  "version": "0.5.0",
  "connections": {}
}

I made the creatio configuration side:

https://academy.creatio.com/documents/administration/7-16/set-exchange-listener-service-side-creatio?document=administration#CSH_5 

Now, I can send emails but when I try to sync the mailbox I got this error:

[ExchangeListener.Subscription.ServiceFactory] 2020-06-16 11:57:47,885 [39] INFO : [18e30f9f-a1e7-4718-9cd1-e16577924fa2] End processing EmailMessage with id '31'.
[ExchangeListener.DataSend.EventDataSender] 2020-06-16 11:57:47,886 [39] DEBUG:  EventDataSender sending request to http://localhost:7700/0/ServiceModel/ExchangeListenerService.svc/ProcessFullEmail
[ExchangeListener.Email.Events.EmailEventProcessor] 2020-06-16 11:57:47,890 [42] ERROR: [18e30f9f-a1e7-4718-9cd1-e16577924fa2] [06/16/2020 11:57:47] Mailbox creatio123456789@gmail.com: error sending emails ['<71fe88dc-0198-4eca-8cc9-a8771976b3ab@gmail.com>' in folder ,'<71fe88dc-0198-4eca-8cc9-a8771976b3ab@gmail.com>' in folder ] to http://localhost:7700/0/ServiceModel/ExchangeListenerService.svc/NewEmail.
System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.Http.CurlException: Couldn't connect to server
   at System.Net.Http.CurlHandler.ThrowIfCURLEError(CURLcode error)
   at System.Net.Http.CurlHandler.MultiAgent.FinishRequest(StrongToWeakReference`1 easyWrapper, CURLcode messageResult)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at ExchangeListener.DataSend.EventClient.PostAsync(String requestUri, HttpContent content) in /src/src/ExchangeListener/DataSend/EventClient.cs:line 42
   at ExchangeListener.DataSend.EventDataSender.Send(String url, Object data) in /src/src/ExchangeListener/DataSend/EventDataSender.cs:line 85
   at ExchangeListener.DataSend.EventDataSender.SendEmail(Object data, SynchronizationCredentials credentials) in /src/src/ExchangeListener/DataSend/EventDataSender.cs:line 95
   at ExchangeListener.Email.Events.BaseEventProcessor.SendRequestObject(Object requstDtoObject, SynchronizationCredentials credentials) in /src/src/ExchangeListener/Email/Events/BaseEventProcessor.cs:line 149
   at ExchangeListener.Email.Events.EmailEventProcessor.SendEmailMessagesToBpm(List`1 messages, SynchronizationCredentials credentials) in /src/src/ExchangeListener/Email/Events/EmailEventProcessor.cs:line 66
[ExchangeListener.Imap.Subscription.ResentEmailsSynchronization] 2020-06-16 11:57:47,892 [39] INFO : [18e30f9f-a1e7-4718-9cd1-e16577924fa2] Email ids sended to bpm.
[ExchangeListener.Imap.Subscription.ResentEmailsSynchronization] 2020-06-16 11:57:47,892 [39] INFO : [18e30f9f-a1e7-4718-9cd1-e16577924fa2] Synchronization session for creatio123456789@gmail.com ended.

 

Thank you

Mohamed

Like 1

Like

4 comments

Hello Mohamed,

 

This is strange that your Exchange service returns this:

{
  "ServiceStatus": "Started",
  "version": "0.5.0",
  "connections": {}
}

even after the mailbox was used for emails sending. Please go to the mailbox settings and apply any changes there and see if you see something similar to this after that:

So you see the record about your mailbox there. Or try re-adding your mailbox to the app from scratch.

 

The error message you receive states that ExcahgneListener services couldn't establish the connection to the mail server. Please use this command:

 

ping mail_server_ip_address

 

from the ExchangeListener server so to test the connectivity. Also please check if the "The URL of the Exchange event processing service in Creatio" system setting has the value of https://mycreatio.com/0/ServiceModel/ExchangeListenerService.svc/NewEmail.

 

I've deployed the service on my end using the Academy instructions and everything is working properly so it should work as expected on your end and the problem can be in the connection between the email server and the ExchagneListener service.

 

Best regards,

Oscar

Dear Oscar Dylan,

 

Problem solved! It was a networking issue in Docker for Windows.

 

For everyone who may have this issue, you have to use host.docker.internal variable as your host IP address.

More information: https://docs.docker.com/docker-for-windows/networking/

Hi Mohamed,

 

I am running into the same issue for an on-prem dev image.  You indicated the issue was resolved via "For everyone who may have this issue, you have to use host.docker.internal variable as your host IP address."  Could you elaborate on that?  I read the article on docker for windows networking but wasn't clear on how you implemented the resolution.  Thanks so much :)

 

Update - never mind. Figured it out.  Using host.docker.internal in place of localhost in all cases. This resolves everything and ExchangeListener is working for both syncing and sending.  Thanks!!  :)

Hi Mohamed,

Can you help me with following questions:

Did you use OS setup file or pull request for installing Redis?

How did you set up redis host address?

Where exactly we use "host.docker.internal" variable. The link you shared doesnt seem to work.

 

Thank you

Gokul

Show all comments