1 Reply Latest reply on Sep 2, 2013 6:19 PM by 887796-Oracle

    CEP Custom File Adapter


      Good Day!


      I'm new to CEP. I would like to ask how can I develop a custom file adapter wherein it tries to get only new lines added into the file.


      I'm trying also to integrate this with BAM for reporting. Any tutorials out there which I can refer upon?






        • 1. Re: CEP Custom File Adapter

          Hi Jeff,


          You create your qwn adapter by creating a bean or an event bean.


          If your adapter needs to send events to the EPN (for example the new lines that you read from the file) then you need to create an event bean.


          Your event bean will needs implement the StreamSource API. If you want to read the file periodically then you will need to create a loop. One way to do this is using the RunnableBean API.


          So your adapter code should look something like that:


          public class FileAdapter implements StreamSource, RunnableBean{


              StreamSender sender;

              boolean suspendFlag = false;



              public void setEventSender(StreamSender sender) {

                  this.sender = sender;




              public void run() {


                      // read the file


                      // implement your logic


                      // create an event instance








              public synchronized void suspend() throws Exception {

                  suspendFlag = true;



              private synchronized boolean getSuspendFlag(){

                  return suspendFlag;







          As for BAM:

          One way is to put the events that your EPN produces to a queue. It is very common practice for the BAM to read messages from a queue. Since BAM is deployed on weblogic and since weblogic can also act as a JMS server, you can put the queue on the BAM weblogic.


          However, if this queue needs to be highly available, or if the load on it is going to be very high, it recommended to put it on separate weblogic or weblogic cluster.


          Hope this helps,