Hazelcast MDB

Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/

Categories

Categories

Hazelcast Application Layer Libs Distributed Applications
GroupId

GroupId

com.github.rmannibucau
ArtifactId

ArtifactId

hazelcast-mdb
Last Version

Last Version

0.1.1
Release Date

Release Date

Type

Type

rar
Description

Description

Hazelcast MDB
Sonatype helps open source projects to set up Maven repositories on https://oss.sonatype.org/
Source Code Management

Source Code Management

https://github.com/rmannibucau/hazelcast-mdb

Download hazelcast-mdb

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.rmannibucau/hazelcast-mdb/ -->
<dependency>
    <groupId>com.github.rmannibucau</groupId>
    <artifactId>hazelcast-mdb</artifactId>
    <version>0.1.1</version>
    <type>rar</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.rmannibucau/hazelcast-mdb/
implementation 'com.github.rmannibucau:hazelcast-mdb:0.1.1'
// https://jarcasting.com/artifacts/com.github.rmannibucau/hazelcast-mdb/
implementation ("com.github.rmannibucau:hazelcast-mdb:0.1.1")
'com.github.rmannibucau:hazelcast-mdb:rar:0.1.1'
<dependency org="com.github.rmannibucau" name="hazelcast-mdb" rev="0.1.1">
  <artifact name="hazelcast-mdb" type="rar" />
</dependency>
@Grapes(
@Grab(group='com.github.rmannibucau', module='hazelcast-mdb', version='0.1.1')
)
libraryDependencies += "com.github.rmannibucau" % "hazelcast-mdb" % "0.1.1"
[com.github.rmannibucau/hazelcast-mdb "0.1.1"]

Dependencies

compile (1)

Group / Artifact Type Version
com.hazelcast : hazelcast jar 2.5

provided (1)

Group / Artifact Type Version
org.apache.openejb : javaee-api jar 6.0-5

test (4)

Group / Artifact Type Version
junit : junit jar 4.11
org.jboss.arquillian.junit : arquillian-junit-container jar 1.0.3.Final
org.apache.openejb : arquillian-openejb-embedded-4 jar 4.5.1
org.apache.openejb : ziplock jar 1.5.1

Project Modules

There are no modules declared in this project.

Goal

Use MDB API to listen Hazelcast messages.

Basic usage

@MessageDriven(activationConfig = {
    @ActivationConfigProperty(propertyName = "target", propertyValue = "foo"),
    @ActivationConfigProperty(propertyName = "targetType", propertyValue = "topic"),
    @ActivationConfigProperty(propertyName = "instance", propertyValue = "bar"),
    @ActivationConfigProperty(propertyName = "poolSize", propertyValue = "10")
})
public static class HazelcastMDB implements HazelcastMessageListener<DataMessage<String>> {
    public static CountDownLatch latch = new CountDownLatch(1);
    public static Object lastMessage = null;

    @Override
    public void onMessage(final DataMessage<String> o) {
        lastMessage = o.getMessageObject();
        latch.countDown();
    }
}

Configuration (as activation properties)

Name Value
target name of the structure (map, queue...)
targetType type of the structure: topic, map, queue, multi-map, list, set
instance hazelcast instance name if not the default one (hazelcast)
poolSize number of listeners to create

HazelcastMessageListener interface

This interface marks a Hazelcast MDB. Its generic type is the type of listened message. here are the type by targetType:

targetType Message type
topic com.hazelcast.core.Message<?>
map com.hazelcast.core.EntryEvent
queue com.hazelcast.core.ItemEvent<?>
multi-map com.hazelcast.core.EntryEvent
list com.hazelcast.core.ItemEvent<?>
set com.hazelcast.core.ItemEvent<?>

Versions

Version
0.1.1
0.1