Coherence JavaScript Client Now Available for Community Edition

Exciting news overnight that the Coherence JavaScript client is now available for Coherence Community Edition 20.06.1!

Previously, the only way to access Coherence from a Node.js application was via REST, but now you have the capability to access Coherence caches via a native JS API with familiar Map interface along with the capabilities of querying, aggregations, in-place processing and events.

The JavaScript client communicates using gRPC (https://grpc.io/) to a gRPC enabled Proxy server on a the Coherence cluster. This is the second client (After Java gRPC client) to take advantage of our native support for gRPC and surely won’t be the last.

It’s as easy as adding the dependency to your package.json file:

"dependencies": {
    "@oracle/coherence": "^1.0.0",
    ...
},

Starting a gRPC enabled Coherence Docker image:

docker run -d -p 1408:1408 oraclecoherence/coherence-ce:20.06.1

and finally running your code:

const { Session } = require('@oracle/coherence')
 
let session = new Session()
let map = session.getMap('Test')
 
setImmediate(async () => {
  console.log("Map size is " + (await map.size))
  console.log("Inserting entry (key=1, value=One)")
  await map.set(1, "One")
  console.log("Map entry is " + (await map.get(1)))
  console.log("Deleting entry (key=1)")
  await map.delete(1)
  console.log("Map size is " + (await map.size))
  await session.close()
})

See here for Randy Stafford’s full post on the release on Medium.

References:

Enjoy!

This entry was posted in News and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s