Code Monkey home page Code Monkey logo

infinispan-remote-tutorial's Introduction

Infinispan Remote Tutorial

Overview

This is a tutorial which explains how to access and use Infinispan Servers using Remote APIs offered from within your own application.

Each tagged commit is a separate lesson teaching a single aspect of Infinispan.

Prerequisites

Git

  • A good place to learn about setting up git is here
  • Git home (download, documentation)

JDK

  • Get a JDK. You will need version 1.7 or higher

Maven

  • Get Maven. You will need version 3.2 or higher

Commits / Tutorial Outline

You can check out any point of the tutorial using

git checkout step-?

To see the changes between any two lessons use the git diff command.

git diff step-?..step-?

step-0/remote-cache-manager

  • Setup a basic Maven project with dependencies
  • Create a simple class which connects to an Infinispan Server
  • To run tutorial section:
  • Download Infinispan Server and unzip locally
  • Start server running bin/standalone.sh or bin/standalone.bat
  • Run mvn compile exec:java to execute the application

step-1/remote-cache-reading-writing

  • Automate downloading and unzipping of Infinispan Server via Maven
  • Automate starting and stopping Infinispan Server using Arquillian
  • Create a test where the Infinispan Server details are injected
  • Connect to the Infinispan Server and obtain the default cache
  • Store an entry into the remote cache
  • Retrieve an entry from the remote cache
  • Print the entry and assert that it contains the expected value
  • Execute mvn verify -Dit.test=RemoteIT to verify remote cache reads and writes as expected
  • You can run this section and all other integration tests by calling mvn verify

step-2/remote-expiration

  • Storing entries which expire
  • Execute mvn verify -Dit.test=RemoteIT to verify expiration works (mvn verify to run all integration tests)

step-3/remote-concurrency

  • Demonstrates how to keep a counter consistent with concurrent modifications using the remote concurrent APIs
  • Execute mvn verify -Dit.test=RemoteConcurrencyIT to verify that the concurrent APIs work as expected (mvn verify to run all integration tests)

step-4/remote-listeners

  • Receive events in the client when entries in the cache change
  • Execute mvn verify -Dit.test=RemoteListenerIT to see remote events in action (mvn verify to run all integration tests)

step-5/remote-filter-listeners

  • Receive events in the client only for filtered keys
  • Core dependency added to implement cache event filter SPI
  • Execute mvn verify -Dit.test=RemoteListenerFilterIT to see filtered remote events in action (mvn verify to run all integration tests)

step-6/remote-custom-events-listeners

  • Receive custom events in the client which include value as well as key
  • Execute mvn verify -Dit.test=RemoteListenerCustomIT to see custom remote events in action (mvn verify to run all integration tests)

step-7/remote-rest-http-api

  • Shows how to interact with the Infinispan REST Http API to store, retrieve and delete data
  • Demonstrates REST Http conditional store operations using ETag information
  • Includes examples on how to store ephemeral entries via REST Http API
  • Execute mvn verify -Dit.test=RemoteRestHttpIT to see custom remote events in action (mvn verify to run all integration tests)

step-8/remote-compatibility

  • Demonstrates Infinispan's compatibility mode where data can be stored and retrieved using different remote endpoints.
  • In this tutorial, interaction between REST and RemoteCache (Hot Rod protocol) endpoints is shown via a simple application that stores simplified stock market.
  • Data stored via RemoteCache can be retrieved via REST and vice-versa.
  • In order for compatibility to work, stored data needs to be transformed from one endpoints' format to the other's. This is why this tutorial adds an Arquillian extension in order to install/uninstall a module containing the classes representing the stored data.
  • Execute mvn verify -Dit.test=RemoteCompatibilityIT to see remote compatibility mode in action (mvn verify to run all integration tests)

Application Directory Layout

src/                -->
  main/             -->
    java/           -->
    resources/      -->
  test/             --> test code root directory
    java/           --> java test classes root directory
    resources/      --> test resources, e.g. arquillian configuration file

Contact

For more information on Infinispan please check out http://infinispan.org/

infinispan-remote-tutorial's People

Contributors

galderz avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.