ESME Blog

enterprise microsharing in a process context
February 14, 2009

Improved Java API moved to Apache

Author: dick - Categories: Development, Integration - Tags: , ,

Darren Hague has moved the ESME Client based on the Java Api from the Google Code repository to our Apache repository. He also added additional methods including the critical ”getMessages” method which was previously missing. It is now possible to easily create bots that integrate with existing environments.  Darren has also provided a test application (with code) that shows how to use the API.

The JAVA API is still a work in progress but the most important parts are now present.

October 26, 2008

The Netweaver Logger

Author: dick - Categories: Development - Tags: , ,

At the Demo Jam at the SAP TechEd in Berlin, we presented a NetWeaver-based logger that sent ESME messages in response to exceptions in the Java Stack. The code is available on our Google Code repository. Just like our ABAP-based integrations, we have a created a JAVA API class that wraps the REST-API.  The wrapper class isn’t complete yet but it contains enough functionality to be able to send ESME messages via Java.

The method below is the “heart” of the ESME functionality and sends message via ESME.

public void handleEvent(MessageEvent event)
{
   LogRecord rec = event.getLogRecord();
   Message esmeMsg = new Message();
        
    int msgLength = rec.getMessage().length();
        
    String message = rec.getMessage().substring(0,(msgLength<255)?msgLength:255);
       
    String[] lines = message.split(”\n”);
    StringBuffer wrappedMsg = new StringBuffer(255);
    for (int i=0; i<lines.length; i++)
    {      

       wrappedMsg.append(wrap(lines[i], 55));
     }
     esmeMsg.setText(wrappedMsg.toString());
        
     String[] tags = new String[4];
     tags[0] = Severity.toString(rec.getSeverity());
     tags[1] = rec.getApplication().replace(’.',’ ‘);
     tags[2] = rec.getLocationName().replace(’.',’ ‘);
     tags[3] = rec.getUser();
     esmeMsg.setTags(tags);
  
     esmeMsg.setVia(”NetWeaverLogger”);
  
     esme.sendMsg(esmeMsg);
 }

With this code, it should be relatively easy to integrate other message sources into ESME.

Thanks to Darren for contributing the code.