Hi,
We are trying to do some improvements to the notification sending module
where we have integrated analytics common features in IS, in order to send
several notifications (ex:Email, SMS).
Current implementation is in [1], there only the email notification was
focused where we are directly publishing to the EmailEventAdapter.
Now we are trying to send notifications via publishing an event to the
Event stream without directly calling an Output Adapter. The approach we
have taken is as follows.
*1) In server start up following will be created.i) A stream for each and
every notification type including the necessary attributes. Ex: Email
Notification - a Stream with the subject, body and footer as attributesii)
Event Publishers, registered for each and every stream in the required
Output event adapter type. Ex: Email Notification - event Publisher in
email output event adapter type.2) Publishing an event to
EventStreamService, which includes an arbitrary data map with the necessary
data needed for the specific notification type. Ex: Email Notification
- Please find the code segments in [2] for having a better understanding.*
There in IS side, we are selecting a specific email template and will be
filled out the place holders before sending the subject, body and footer as
arbitrary map attributes.
But even-though we passed an arbitrary data map, when we are sending an
email from the EmailEventAdapter, it won't filter out the subject, body or
header from that arbitrary data map.
As I have understood, if someone pass an event with an arbitrary data map,
the email body will be set as [3] (Refer [4]), it won't filter out the
content(Refer [5]).
Is this has to be worked if we provide *output mappings* for event
publisher as* {{subject}{body}{footer}}* to convert the event to the
supported format?
I have gone through the code [6], where the event data will be passed
through EventStreamProducer, but there also seems like it's not possible to
send an email in required format(subject, body and footer).
Really appreciate your comments/suggestions to understand the correct
approach to be taken.
[1]
https://github.com/wso2-extensions/identity-event-handler-email/blob/master/components/event-handler-email/org.wso2.carbon.identity.event.handler.email/src/main/java/org.wso2.carbon.identity.event.handler.email/handler/EmailEventHandler.java#L164
[2]
https://drive.google.com/a/wso2.com/file/d/0Bz_EQkE2mOgBY00yYVpGelZJNms/view?usp=sharing
[3]
https://drive.google.com/a/wso2.com/file/d/0Bz_EQkE2mOgBNEMtYjJvSFB2emM/view?usp=sharing
[4]
https://github.com/wso2/carbon-analytics-common/blob/master/components/event-publisher/org.wso2.carbon.event.publisher.core/src/main/java/org/wso2/carbon/event/publisher/core/internal/type/text/TextOutputMapper.java#L139
[5]
https://github.com/wso2/carbon-analytics-common/blob/master/components/event-publisher/event-output-adapters/org.wso2.carbon.event.output.adapter.email/src/main/java/org/wso2/carbon/event/output/adapter/email/EmailEventAdapter.java#L233
[6]
https://github.com/wso2/carbon-event-processing/blob/master/components/event-simulator/org.wso2.carbon.event.simulator.core/src/main/java/org/wso2/carbon/event/simulator/core/internal/CarbonEventSimulator.java#L183
Thanks and Regards
--
Indunil Upeksha Rathnayake
Software Engineer | WSO2 Inc
Email [email protected]
Mobile 0772182255
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev