# emqx-extension-java-sdk
**Repository Path**: mirrors_emqx/emqx-extension-java-sdk
## Basic Information
- **Project Name**: emqx-extension-java-sdk
- **Description**: The Java SDK for emqx-extension-hook
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-08-08
- **Last Updated**: 2026-05-30
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# Extension For Java SDK
This repostory provide a Java SDK based on [emqx-extension-hook](https://github.com/emqx/emqx-extension-hook).
## Requirements
- JDK 1.8+
- Depend on `erlport.jar` (The communication module used in emqx-extension-hook)
## SDK edition & EMQ X Broker edition
| SDK edition | EMQ X Broker edition |
| ----------- | -------------------- |
| 1.0.0 | 4.2.0 |
| unsupport | before 4.2.0 |
## Get Started
1. First of all, create your Java project.
2. See `SDK edition & EMQ X Broker edition` part. Chose your SDK edition.Depends on EMQ X Broker edition.
Download the [io.emqx.extension.jar](https://search.maven.org/search?q=a:emqx-extension-java-sdk) and [erlport.jar](https://github.com/emqx/emqx-extension-java-sdk/raw/master/deps/erlport-v1.2.2.jar)
3. Add the sdk: `io.emqx.extension.jar` and `erlport.jar` to your project dependency.
If your project is a maven project, add a dependency in your maven project `pom.xml` ``.
```xml
io.emqx
emqx-extension-java-sdk
1.0.0
```
Change `version` to your chosen SDK edition, like `1.0.0`.
4. Copy the `examples/SampleHandler.java` into your project.
5. Successfully compile all the source codes.
Note: NOT read/write `System.out.*` and `System.in` Stream. They are used to communicate with EMQ X.
## Deploy
After compiled all source codes, you should deploy the `sdk` and your class files into EMQ X.
1. Copy the `io.emqx.extension.jar` to `emqx/data/extension` directory.
2. Copy your class files, e.g: `SampleHandler.class` to `emqx/data/extension` directory.
3. Modify the `emqx/etc/plugins/emqx_extension_hook.conf` file. e.g:
```protperties
exhook.drivers = java
## Search path for scripts or library
exhook.drivers.java.path = data/extension/
exhook.drivers.java.init_module = SampleHandler
```
4. Execute `bin/emqx console` to start EMQ X and load the `emqx_extension_hook` plugin.
5. Try to establish a MQTT connection and observe the console output.
## Examples
See: examples/SampleHandler.java
## License
Apache License v2
## Authors
- [Chong Yuan](https://github.com/chongyuanyin)