udp-jca-adapter

udp-jca-adapter-parent

License

License

GroupId

GroupId

com.github.exabrial
ArtifactId

ArtifactId

udp-jca-adapter
Last Version

Last Version

1.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

udp-jca-adapter
udp-jca-adapter-parent
Source Code Management

Source Code Management

https://github.com/exabrial/udp-jca-adapter/tree/master/udp-jca-adapter

Download udp-jca-adapter

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.exabrial/udp-jca-adapter/ -->
<dependency>
    <groupId>com.github.exabrial</groupId>
    <artifactId>udp-jca-adapter</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.exabrial/udp-jca-adapter/
implementation 'com.github.exabrial:udp-jca-adapter:1.1.0'
// https://jarcasting.com/artifacts/com.github.exabrial/udp-jca-adapter/
implementation ("com.github.exabrial:udp-jca-adapter:1.1.0")
'com.github.exabrial:udp-jca-adapter:jar:1.1.0'
<dependency org="com.github.exabrial" name="udp-jca-adapter" rev="1.1.0">
  <artifact name="udp-jca-adapter" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.exabrial', module='udp-jca-adapter', version='1.1.0')
)
libraryDependencies += "com.github.exabrial" % "udp-jca-adapter" % "1.1.0"
[com.github.exabrial/udp-jca-adapter "1.1.0"]

Dependencies

compile (2)

Group / Artifact Type Version
com.github.exabrial : udp-jca-adapter-api jar 1.1.0
org.slf4j : slf4j-api jar 1.7.30

provided (2)

Group / Artifact Type Version
javax.resource : javax.resource-api jar 1.7.1
org.projectlombok : lombok jar 1.18.12

Project Modules

There are no modules declared in this project.

udp-jca-adapter

Description

A JCA 1.7 compliant Resource Adapter RAR to accept UDP packets with full modern Java EE facilities in a fast memory safe language.

Motivation / Use Case

Do you want to accept UDP connections in Java, but have full access to CDI, JAX-RS, JPA, SQL, JTA, etc?

Simply implement the UDPMessageListener interface:

import java.math.BigInteger;
import java.net.InetAddress;

import javax.ejb.MessageDriven;

@MessageDriven
public class UDPDumper implements UDPMessageListener {
   @Inject
   private Logger log;

	@Override
	public byte[] onPacket(final byte[] payload, final InetAddress sourceAddress) {
		log.info("onPacket() UDP packet from:{}", sourceAddress.getHostAddress());
		return null;
	}
}

Maven Coordinates

The API jar contains the interface you need to implement.

		<dependency>
			<groupId>com.github.exabrial</groupId>
			<artifactId>udp-jca-adapter-api</artifactId>
			<version>1.1.0</version>
			<scope>compile</scope>
		</dependency>

Installation

RAR installation by app server differs greatly by server. Most of the time you install a JCA adapter at the EAR or server level.

Easiset deployment: Apache TomEE 8.0.4+ embedded war deployment

To deploy at the Application level, add the following to your app's pom.xml, then copy the ra.xml from the into your WEB-INF directory.

		<dependency>
			<groupId>com.github.exabrial</groupId>
			<artifactId>udp-jca-adapter</artifactId>
			<version>1.1.0</version>
			<scope>runtime</scope>
		</dependency>

Configuration

config option type default
port int 5553
maxPacketSize int 512
address String localhost

Versions

Version
1.1.0
1.0.0