2
votes

Based on the article Configuring a polling event source to send push notifications on IBM website, I tried to create a polling event source using a Sql adapter and deployed the adapter to my local MFP Server to observe its behavior.

function doSomething(){
    WL.Logger.info(new Date() + " :: doing something");
}

WL.Server.createEventSource({
   name: "tada",
   poll: {
       interval: 3,
       onPoll: "doSomething"
   }
});

My development environment:

  • OS X El Capitan
  • JDK 1.8.0 64-bit
  • Eclipse Mars
  • MobileFirst Platform Foundation 7.1

However, instead of showing text log in the Eclipse console, it is showing errors instead (every few seconds):

[ERROR   ] ErrorID:40917855-1464858567623-21
Unknown exception: null
[ERROR   ] ErrorID:40917855-1464858597627-22
Unknown exception: null
[ERROR   ] ErrorID:40917855-1464858627632-23
Unknown exception: null

Does anyone know what is going on here?

1
If you were to put those lines in another adapter procedure and invoke it like any , do you see the same errors? Another point - just try WL.Logger.info(new Date());Vivin K
I tried to move the line WL.Server.createEventSource() into one of my existing procedures and invoked the procedure. It gave me a new error: "This method can only be invoked during adapter initialization". And no luck with WL.Logger.info(new Date()); too.Got Hima
After I had tried with a few changes, I decided to roll back to my original code (as posted above) and stop the MobileFirst Server (by clicking the Terminate button in the Eclipse MFP Server Console) and then restart it by re-deploying my Sql adapter. Guess what? Now my first-ever MobileFirst polling event source is working like a charm!Got Hima
Can you please put that as answer to the post? So that others will benefit from itVivin K
Ok, thanks Vivin K for your prompt response to my question!Got Hima

1 Answers

1
votes

I managed to find a solution to this weird error. If you're developing locally, first stop your local MobileFirst Server (by clicking the Terminate button in the MFP Server Console of Eclipse). Then restart it by re-deploying your http/sql/jms/etc. adapter. Your polling event source should now be working in your local MFP server.

I'm still having an issue though - minor one perhaps. I couldn't see any log printed in the MFP Server Console of Eclipse even though I'm using the WL.Logger.info() method as illustrated by the IBM guide. How I managed to monitor the log generated is by going to the Analytics Console and download the Server Logs file. This is my workaround just in case anyone faces the same issue.