Introduction
I have just finished integrating ESME into Apache OFBiz which is an open-source ERP platform.
The Apache Open For Business Project is an open source enterprise automation software project licensed under the Apache License Version 2.0. By open source enterprise automation we mean: Open Source ERP, Open Source CRM, Open Source E-Business / E-Commerce, Open Source SCM, Open Source MRP, Open Source CMMS/EAM, and so on.
I used OFBiz’s event environment to plug-in ESME functionality.
ECAs are pretty straight forward: when an Event occurs, if the Condition(s) are met then Action(s) are performed. The Events supported currently are Entity (EECA) events which basically correspond to database record CRUD events, Service (SECA) events which correspond the various stages of a given service’s invocation (invoke, validate, commit, return, etc.) and Mail (MECA) events which occur when an email is received.
I used the entity “Facility” as a prototype but any entity would be possible. I also selected that the events would just be sent when new facilities were created but I could have just as easily responded to other entity-related events (deletes, updates, etc.)
My goal was to easily integrate the two environments as quickly as possible. Once I figured out what to do, the integration was relatively easy. I used a local ESME instance that was separate from the OFBiz instance.
Screenshots
Here I create a new facility https://localhost:8443/facility/control/CreateFacility.
Here is the screenshot from ESME that shows the message that was sent in response to the creation of a new facility.
Technical details
Authorization
The use of the ESME REST API requires a token. I’ve manually stored this token in the externalAuthId value of the UserLogin entity. https://localhost:8443/webtools/control/ViewGeneric?entityName=UserLogin&userLoginId=system
I added a token to the system user to be used in the ESME REST API calls.
Message Contents
I’ve selected just three attributes of the Facility entity to be displayed in the ESME message. I looked at the details of the entity and just selected those that were easiest to use. Other attributes could also be used as well. https://localhost:8443/webtools/control/ViewGeneric?entityName=Facility&enableEdit=true
Implementation Details
For details on the implementation, see the Apache ESME wiki page here
Improvements
1. Use of externalAuthId to store the ESME token. The use of SSO would probably be better
2. Use of system as service user. For some reason, the user who fired the event was always “system” rather than the actual user who created the facility.
3. No OFBiz UI. Right now there is no UI in OFBiz to display the ESME messages.
4. Ideally, there should be a common service that sends the message to ESME and entity-specific services that compose the message to be sent.
5. Use of the new Streaming API to send to a specific pool rather than the public pool. Right now, I’m using the Twitter API to send the message. Ideally, the new API should be used to send to a specific pool.




0 Comments until now
Add your Comment!