Book Image

Getting Started with Hazelcast, Second Edition

By : Matthew Johns
Book Image

Getting Started with Hazelcast, Second Edition

By: Matthew Johns

Overview of this book

Table of Contents (19 chapters)
Getting Started with Hazelcast Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Going RESTful


An alternative to memcache is the even more generic RESTful API. Without wanting to go into too much detail, REST is a popular convention of providing HTTP access to data via resources. These are set up to provide path-like access to collections, objects, and properties. Hazelcast additionally provides a simple HTTP service built into each of the nodes to enable access to our standard map and queue collections via HTTP.

The structure of the API is pretty simple:

  • http://127.0.0.1:5701/hazelcast/rest/maps/<mapName>/<key>

  • http://127.0.0.1:5701/hazelcast/rest/queues/<queueName>

If <mapName> or <queueName> is as configured within our application, we can use the standard REST convention of the HTTP method to describe the type of operation that we wish to perform.

In the case of maps, we send the appropriate key as required, but use a POST method to create or update an entry, thereby specifying an appropriate MIME type as needed.

$ curl -v -X POST -H ...