Blogs Microservices with Wildfly Swarm and Infinispan

Microservices with Wildfly Swarm and Infinispan

Everybody loves Microservices, right?

Today, all of us have slightly different understanding what Microservices are but, among all those definitions and attributes, there’s probably one thing that fits them all - they need to be simple.

So let’s have a look at some practical example of creating a REST service with Infinispan as a storage wired together using CDI. We will use Wildfly Swarm as a running platform.

Bootstrapping new project

A good way to start a new Wildfly Swarm project is to generate it. The only requirement here is to add "JAX-RS with CDI" and "JPA" as dependencies.

The next step is to add infinispan-embedded artifact. The final pom.xml should look like the following:

Writing some code

 https://infinispan.org/docs/dev/user_guide/user_guide.html#cdi_support[Infinispan
CDI Extension] will take care of bootstrapping Infinispan, so we can
dive directly into JAX-RS code:

And that’s it!

What’s next?

If you’d like to have a look at the complete example, check out my repository. The code is based on fresh build from Infinispan master branch which contains lots of improvements for CDI. You might build it yourself or just wait for 9.0.0.Beta1.

Have a lot of fun with Microservices!

Get it, Use it, Ask us!

We’re hard at work on new features, improvements and fixes, so watch this space for more announcements!

Please, download and test the latest release.

The source code is hosted on GitHub. If you need to report a bug or request a new feature, look for a similar one on our GitHub issues tracker. If you don’t find any, create a new issue.

If you have questions, are experiencing a bug or want advice on using Infinispan, you can use GitHub discussions. We will do our best to answer you as soon as we can.

The Infinispan community uses Zulip for real-time communications. Join us using either a web-browser or a dedicated application on the Infinispan chat.