On Tue, Jan 23, 2018 at 10:54 PM, Hasanthi Purnima Dissanayake <
[email protected]> wrote:

> Hi All,
>
> Requirement :
> We have a requirement to insert/update or delete a row from a db table
> once access token or authorization code is generated, revoked, code or
> token status changed or a refresh token is issued. Without directly
> invoking the db, we thought of implementing events to trigger when one of
> the above scenario happens. So the existing architecture is kind of service
> layer is responsible of issuing/revoking/deleting tokens or codes and this
> layer is directly invoking the DAO layer for db calls. So we have two
> places to implement events in the service layer or the DAO layer.
>
> Problem :
> If we are implementing the events in the service layer, then we have to
> trigger multiple events in multiple places as we are doing above operations
> in multiple places in the service layer. Also some of the service layer
> classes are extensible so we cannot guarantee that a third party extension
> developer will implement the events in the extended code.
>
> If we are implementing the events in the DAO layer, then the DAO layer
> isolation will be violated.
>
> Ideally there should be a middle layer in between the service layer and
> the DAO layer for such kind of situations. As we don't have such a middle
> layer, ATM we have implemented the events in the DAO layer.
>
> Highly appreciate any feedback on above.
>
Yes. It  is better to have a middle layer to publish the events rather than
publishing from the DAO layer.

Thanks
Isura.


>
> Thanks,
>
> --
>
> Hasanthi Dissanayake
>
> Senior Software Engineer | WSO2
>
> E: [email protected]
> M :0718407133| http://wso2.com <http://wso2.com/>
>



-- 

*Isura Dilhara Karunaratne*
Associate Technical Lead | WSO2
Email: [email protected]
Mob : +94 772 254 810
Blog : http://isurad.blogspot.com/
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to