Search code examples
javaapache-sparkibm-cloudwebsphere-liberty

Spark service on Bluemix call from a Java Liberty app


I would like to ask how can I connect the Spark service of Bluemix from an application loaded on Java Liberty (still on Bluemix)?

Thank you


Solution

  • Open your bluemix dashboard and then open your Java Liberty CF App by clicking on it from CF Apps. Click On Overview and then you can add a new spark service or bind your existing spark service from bluemix by clicking on the tiles for ADD A SERVICE OR API or BIND A SERVICE OR API. Once your service is added then you can check the credentials by clicking on Show Credentials.

    Now Whatever you are trying to do from your liberty APP, you can use those credentials to do your stuff.

    But Practically, Apache-spark service is used for analytics using notebooks to do interactive data analysis or you can run jobs using spark-submit which is command line utility.

    So if you java-liberty app going to consume some analytical output result, you can run spark-submit jobs from your java-liberty app programmatically and then read the output from console(But i am not sure if this approach would be good). But Recommended approach would be to let your spark-submit job store results in some Object store and then read that from your java-liberty app.

    https://console.ng.bluemix.net/docs/services/AnalyticsforApacheSpark/index-gentopic3.html#genTopProcId4

    Thanks,

    Charles.