GithubHelp home page GithubHelp logo

siddhi-io / siddhi-io-email Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 31.0 2.84 MB

Extension that receives and publishes events via email

Home Page: https://siddhi-io.github.io/siddhi-io-email/

License: Apache License 2.0

Java 100.00%
email extension html io siddhi text

siddhi-io-email's People

Contributors

ajanthy avatar anugayan avatar buddhiwathsala avatar chathurikaa avatar dilini-muthumala avatar dnwick avatar gimantha avatar gokul avatar grainier avatar janithcmw avatar ksdperera avatar lasanthas avatar maheshika avatar mayuravaani avatar minudika avatar mohanvive avatar nisalaniroshana avatar niveathika avatar pcnfernando avatar rolandhewage avatar rukshiw avatar sajithshn avatar suhothayan avatar sujanan avatar tishan89 avatar wso2-jenkins-bot avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

siddhi-io-email's Issues

Email sink printing password on logs when it cannot connect to the server !!

Description:
This happens when passwords in added to .yaml file in SP

Cannot assign to ChathurikaA for some reason. !


[2017-11-02 00:38:56,368] ERROR {org.wso2.siddhi.core.stream.output.sink.Sink} - Error on 'Sweet-Factory-Analytics'. Error is encountered while connecting to the server with properties: {password=yyyyyy, mail.smtp.port=465, mail.smtp.auth=true, mail.smtp.host=smtp.gmail.com, username=xxx, mail.smtp.ssl.enable=true} Error while connecting at Sink 'email' at 'SLAAlertStream'. java.lang.RuntimeException: Error is encountered while connecting to the server with properties: {password=yyyyyy, mail.smtp.port=465, mail.smtp.auth=true, mail.smtp.host=smtp.gmail.com, username=xxx, mail.smtp.ssl.enable=true}
at org.wso2.extension.siddhi.io.email.sink.EmailSink.connect(EmailSink.java:371)
at org.wso2.siddhi.core.stream.output.sink.Sink.connectWithRetry(Sink.java:177)
at org.wso2.siddhi.core.SiddhiAppRuntime.start(SiddhiAppRuntime.java:285)
at org.wso2.carbon.siddhi.editor.core.internal.DebugRuntime.start(DebugRuntime.java:64)
at org.wso2.carbon.siddhi.editor.core.internal.DebugProcessorService.start(DebugProcessorService.java:37)
at org.wso2.carbon.siddhi.editor.core.internal.ServiceComponent.start(ServiceComponent.java:482)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.wso2.msf4j.internal.router.HttpMethodInfo.invokeResource(HttpMethodInfo.java:187)
at org.wso2.msf4j.internal.router.HttpMethodInfo.invoke(HttpMethodInfo.java:143)
at org.wso2.msf4j.internal.MSF4JMessageProcessor.dispatchMethod(MSF4JMessageProcessor.java:248)
at org.wso2.msf4j.internal.MSF4JMessageProcessor.lambda$receive$73(MSF4JMessageProcessor.java:160)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.wso2.carbon.messaging.exceptions.ClientConnectorException: Error is encountered while creating the connection using the session.535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials z2sm2539509pgo.54 - gsmtp

at org.wso2.carbon.transport.email.sender.EmailClientConnector.init(EmailClientConnector.java:98)
at org.wso2.extension.siddhi.io.email.sink.EmailSink.connect(EmailSink.java:358)
... 16 more

Caused by: javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials z2sm2539509pgo.54 - gsmtp

at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:932)
at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:843)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:748)
at javax.mail.Service.connect(Service.java:388)
at javax.mail.Service.connect(Service.java:246)
at javax.mail.Service.connect(Service.java:195)
at org.wso2.carbon.transport.email.sender.EmailClientConnector.init(EmailClientConnector.java:92)
... 17 more

Spellings mistake in logging error

Description:
There is a spellings mistake in an error message. The name ymal should be converted into yaml.

password is a mandatory parameter. It should be defined in either stream definition or deployment 'ymal' file.
	at io.siddhi.extension.io.email.sink.EmailSink.validateAndGetRequiredParameters(EmailSink.java:588)
	at io.siddhi.extension.io.email.sink.EmailSink.init(EmailSink.java:468)
	at io.siddhi.core.stream.output.sink.Sink.init(Sink.java:99)
	at io.siddhi.core.util.parser.helper.DefinitionParserHelper.addEventSink(DefinitionParserHelper.java:547)
	at io.siddhi.core.util.SiddhiAppRuntimeBuilder.defineStream(SiddhiAppRuntimeBuilder.java:115)
	at io.siddhi.core.util.parser.SiddhiAppParser.defineStreamDefinitions(SiddhiAppParser.java:373)
	at io.siddhi.core.util.parser.SiddhiAppParser.parse(SiddhiAppParser.java:229)
	at io.siddhi.core.SiddhiManager.createSiddhiAppRuntime(SiddhiManager.java:66)
	at io.siddhi.core.SiddhiManager.createSiddhiAppRuntime(SiddhiManager.java:76)
	at io.siddhi.operator.parser.services.SiddhiParserService.getSourceDeploymentConfigs(SiddhiParserService.java:166)
	at io.siddhi.operator.parser.services.SiddhiParserService.parseSiddhiApp(SiddhiParserService.java:97)
	at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.wso2.msf4j.internal.router.HttpMethodInfo.invokeResource(HttpMethodInfo.java:187)
	at org.wso2.msf4j.internal.router.HttpMethodInfo.invoke(HttpMethodInfo.java:143)
	at org.wso2.msf4j.internal.MSF4JHttpConnectorListener.dispatchMethod(MSF4JHttpConnectorListener.java:218)
	at org.wso2.msf4j.internal.MSF4JHttpConnectorListener.lambda$onMessage$57(MSF4JHttpConnectorListener.java:129)
	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:748)

Suggested Labels:
type/fix

A concurrent issue in Email handling

Hi All,

When testing on the siddhi-io-email sink, it is observed some email properties are mixed with the email address.

Steps to reproduce.

  1. Configure the Email sink in wso2si-4.0.0
  2. Deploy the siddhi application[3].
  3. Populate the database table 'EmailInfo' with some email addresses(receiver) and corresponding email bodies.
  4. Then re-deploy the email application again, you will be able to observe that there will be the body and address mix-up in the receiver's email inbox when corresponding to the database entries.
    ex -> If you have added 'recerver1' with the body 'A' in the database, you might get body 'X' in the same recerver1 even if the body 'X' is not added in the database.

Issue in EmailSink.publish method exception handling

Description:
In an active/passive wso2sp setup, when a passive member became an active state, it's trying to flush the events in sink callback handler and publish out to an SMTP server. At that time if there is a Runtime Exception throw by the mail server, coordinatorChanged execution not continues and it breaks the other handers(Source/Sink and Store) activation method execution.

Exception:

message [2018-12-02 04:27:18,727]  WARN {org.wso2.carbon.cluster.coordinator.rdbms.RDBMSMemberEventListenerTask} - Error occurred while reading membership events. java.lang.RuntimeException: Error is encountered while sending the message by the email ClientConnector with properties: {From:...,To:...,...,Content-Type=text/html} at org.wso2.extension.siddhi.io.email.sink.EmailSink.publish(EmailSink.java:476) at org.wso2.siddhi.core.stream.output.sink.Sink.publish(Sink.java:135) at org.wso2.extension.siddhi.map.text.sinkmapper.TextSinkMapper.mapAndSend(TextSinkMapper.java:221) at org.wso2.siddhi.core.stream.output.sink.SinkMapper.mapAndSend(SinkMapper.java:165) at org.wso2.siddhi.core.stream.output.sink.SinkHandlerCallback.mapAndSend(SinkHandlerCallback.java:35) at org.wso2.carbon.stream.processor.core.ha.HACoordinationSinkHandler.setAsActive(HACoordinationSinkHandler.java:153) at org.wso2.carbon.stream.processor.core.ha.HAEventListener.coordinatorChanged(HAEventListener.java:77) at org.wso2.carbon.cluster.coordinator.rdbms.RDBMSMemberEventListenerTask.notifyCoordinatorChangeEvent(RDBMSMemberEventListenerTask.java:104) at org.wso2.carbon.cluster.coordinator.rdbms.RDBMSMemberEventListenerTask.run(RDBMSMemberEventListenerTask.java:77) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748)

Suggested Labels:

Suggested Assignees:

Affected Product Version:
WSO2SP-4.2.0

OS, DB, other environment details and versions:

Steps to reproduce:
In an active/passive wso2sp setup, when a passive member became an active state, it's trying to flush the events in sink callback handler and publish out to an SMTP server. At that time if there is a Runtime Exception throw by the mail server, coordinatorChanged execution not continues and it breaks the other hander activation method execution.

Related Issues:

analytics worker wso2 3.2.0 siddhi mail not generating for outlook

I have configured the below section under siddhi in wso2 YAML file of the analytics worker, it works only for Gmail not for outlook any thoughts on this

this works fine
extension:
name: email
namespace: sink
properties:
username: [email protected]
address: [email protected]
password: *******@12

this does not work

  extension:
        name: email
        namespace: sink
        properties:
          username: [email protected]
          address:  [email protected]
          password: *****!

Error
ERROR {io.siddhi.core.stream.output.sink.Sink} - Error on 'APIM_ALERT_EMAIL_NOTIFICATION'. Error is encountered while connecting to the the smtp server.Error is encountered while creating the connection using the session.535-5.7.8 Username and Password not accepted. Learn more at_535 5.7.8 https://support.google.com/mail/?p=BadCredentials ca6sm5486641pjb.53 - gsmtp_, error while connecting at Sink 'email' at 'EmailNotificationStream'. java.lang.RuntimeException: Error is encountered while connecting to the the smtp server.Error is encountered while creating the connection using the session.535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials ca6sm5486641pjb.53 - gsmtp

    at io.siddhi.extension.io.email.sink.EmailSink.connect(EmailSink.java:496)
    at io.siddhi.core.stream.output.sink.Sink.connectWithRetry(Sink.java:254)
    at io.siddhi.core.SiddhiAppRuntimeImpl.startWithoutSources(SiddhiAppRuntimeImpl.java:451)
    at io.siddhi.core.SiddhiAppRuntimeImpl.start(SiddhiAppRuntimeImpl.java:424)
    at org.wso2.carbon.streaming.integrator.core.internal.StreamProcessorService.deploySiddhiApp(StreamProcessorService.java:215)
    at org.wso2.carbon.streaming.integrator.core.internal.StreamProcessorDeployer.deploySiddhiQLFile(StreamProcessorDeployer.java:95)
    at org.wso2.carbon.streaming.integrator.core.internal.StreamProcessorDeployer.deploy(StreamProcessorDeployer.java:330)
    at org.wso2.carbon.deployment.engine.internal.DeploymentEngine.lambda$deployArtifacts$0(DeploymentEngine.java:291)
    at java.util.ArrayList.forEach(ArrayList.java:1257)
    at org.wso2.carbon.deployment.engine.internal.DeploymentEngine.deployArtifacts(DeploymentEngine.java:282)
    at org.wso2.carbon.deployment.engine.internal.RepositoryScanner.sweep(RepositoryScanner.java:112)
    at org.wso2.carbon.deployment.engine.internal.RepositoryScanner.scan(RepositoryScanner.java:68)
    at org.wso2.carbon.deployment.engine.internal.DeploymentEngine.start(DeploymentEngine.java:121)
    at org.wso2.carbon.deployment.engine.internal.DeploymentEngineListenerComponent.onAllRequiredCapabilitiesAvailable(DeploymentEngineListenerComponent.java:216)
    at org.wso2.carbon.kernel.internal.startupresolver.StartupComponentManager.lambda$notifySatisfiableComponents$7(StartupComponentManager.java:266)
    at java.util.ArrayList.forEach(ArrayList.java:1257)
    at org.wso2.carbon.kernel.internal.startupresolver.StartupComponentManager.notifySatisfiableComponents(StartupComponentManager.java:252)
    at org.wso2.carbon.kernel.internal.startupresolver.StartupOrderResolver$1.run(StartupOrderResolver.java:204)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)

Caused by: org.wso2.transport.email.exception.EmailConnectorException: Error is encountered while creating the connection using the session.535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials ca6sm5486641pjb.53 - gsmtp

    at org.wso2.transport.email.client.connector.EmailClientConnectorImpl.init(EmailClientConnectorImpl.java:139)
    at io.siddhi.extension.io.email.sink.EmailSink.connect(EmailSink.java:484)
    ... 19 more

Caused by: javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials ca6sm5486641pjb.53 - gsmtp

    at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:932)
    at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:843)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:748)
    at javax.mail.Service.connect(Service.java:388)
    at javax.mail.Service.connect(Service.java:246)
    at javax.mail.Service.connect(Service.java:195)
    at org.wso2.transport.email.client.connector.EmailClientConnectorImpl.init(EmailClientConnectorImpl.java:133)
    ... 20 more

[2020-09-17 16:18:07,921] ERROR {io.siddhi.core.SiddhiAppRuntimeImpl} - Error starting Siddhi App 'APIM_ALERT_EMAIL_NOTIFICATION', triggering shutdown process. Error is encountered while connecting to the the smtp server.Error is encountered while creating the connection using the session.535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials ca6sm5486641pjb.53 - gsmtp

[2020-09-17 16:18:07,929] INFO {org.wso2.carbon.streaming.integrator.core.internal.StreamProcessorService} - Siddhi App APIM_ALERT_EMAIL_NOTIFICATION deployed successfully
[2020-09-17 16:18:07,937] INFO {org.wso2.carbon.kernel.internal.CarbonStartupHandler} - WSO2 API Manager Analytics Server started in 44.888 sec

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.