Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/hivemq-skeleton' into hivemq-ske…
Browse files Browse the repository at this point in the history
…leton

# Conflicts:
#	mqtt-core/build.gradle
#	mqtt-hivemq-v3/build.gradle.kts
#	test-suite-utils/src/main/groovy/io/micronaut/mqtt/test/AbstractMQTTTest.groovy
  • Loading branch information
skobow committed Jun 27, 2023
2 parents 5630c25 + 2f527be commit 75b69a3
Show file tree
Hide file tree
Showing 83 changed files with 3,234 additions and 165 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ bin/
*.iws
.kotlintest
*/.kotlintest/
.java-version

# ignore resources, are downloaded via a gradle task from micronaut_docs
src/main/docs/resources/css/highlight/*.css
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
[![Build Status](https://github.com/micronaut-projects/micronaut-mqtt/workflows/Java%20CI/badge.svg)](https://github.com/micronaut-projects/micronaut-mqtt/actions)
[![Revved up by Gradle Enterprise](https://img.shields.io/badge/Revved%20up%20by-Gradle%20Enterprise-06A0CE?logo=Gradle&labelColor=02303A)](https://ge.micronaut.io/scans)

Micronaut MQTT integrations Micronaut with the [Eclipse Paho](https://www.eclipse.org/paho/) MQTT messaging client.
Micronaut MQTT integrations Micronaut with the [HiveMQ](https://hivemq.github.io/hivemq-mqtt-client/) MQTT client.

## Documentation

See the [Documentation](https://micronaut-projects.github.io/micronaut-mqtt/1.0.x/guide/) for more information.
See the [Documentation](https://micronaut-projects.github.io/micronaut-mqtt/1.0.x/guide/) for more information.

See the [Snapshot Documentation](https://micronaut-projects.github.io/micronaut-mqtt/snapshot/guide/) for the current development docs.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ configurations.all {
resolutionStrategy {
force 'io.micronaut.platform:micronaut-platform:4.0.0-M4'
}
resolutionStrategy.preferProjectModules()
}

dependencies {
Expand Down
75 changes: 75 additions & 0 deletions config/accepted-api-changes.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,80 @@
"type": "io.micronaut.mqtt.v5.annotation.MqttPublisher",
"member": "Implemented interface java.lang.annotation.Annotation",
"reason": "Moved to core for Micronaut 4.0.0"
},
{
"type": "io.micronaut.mqtt.ssl.$MqttCertificateConfiguration$Definition$Reference",
"member": "Field $ANNOTATION_METADATA",
"reason": "Migration to HiveMQ MQTT client"
},
{
"type": "io.micronaut.mqtt.ssl.$MqttCertificateConfiguration$Definition$Reference",
"member": "Constructor io.micronaut.mqtt.ssl.$MqttCertificateConfiguration$Definition$Reference()",
"reason": "Migration to HiveMQ MQTT client"
},
{
"type": "io.micronaut.mqtt.ssl.$MqttCertificateConfiguration$Definition$Reference",
"member": "Implemented interface io.micronaut.core.annotation.AnnotationSource",
"reason": "Migration to HiveMQ MQTT client"
},
{
"type": "io.micronaut.mqtt.ssl.$MqttCertificateConfiguration$Definition$Reference",
"member": "Implemented interface io.micronaut.inject.BeanContextConditional",
"reason": "Migration to HiveMQ MQTT client"
},
{
"type": "io.micronaut.mqtt.ssl.$MqttCertificateConfiguration$Definition$Reference",
"member": "Implemented interface io.micronaut.core.annotation.AnnotationMetadataProvider",
"reason": "Migration to HiveMQ MQTT client"
},
{
"type": "io.micronaut.mqtt.ssl.$MqttCertificateConfiguration$Definition$Reference",
"member": "Implemented interface io.micronaut.inject.BeanType",
"reason": "Migration to HiveMQ MQTT client"
},
{
"type": "io.micronaut.mqtt.ssl.$MqttCertificateConfiguration$Definition$Reference",
"member": "Implemented interface io.micronaut.inject.BeanDefinitionReference",
"reason": "Migration to HiveMQ MQTT client"
},
{
"type": "io.micronaut.mqtt.ssl.MqttCertificateConfiguration",
"member": "Constructor io.micronaut.mqtt.ssl.MqttCertificateConfiguration()",
"reason": "Migration to HiveMQ MQTT client"
},
{
"type": "io.micronaut.mqtt.ssl.$MqttConfigurationEventListener$Definition$Reference",
"member": "Field $ANNOTATION_METADATA",
"reason": "Provide a human readable reason for the change"
},
{
"type": "io.micronaut.mqtt.ssl.$MqttConfigurationEventListener$Definition$Reference",
"member": "Constructor io.micronaut.mqtt.ssl.$MqttConfigurationEventListener$Definition$Reference()",
"reason": "Not needed anymore due to migration to HiveMQ MQTT client"
},
{
"type": "io.micronaut.mqtt.ssl.$MqttConfigurationEventListener$Definition$Reference",
"member": "Implemented interface io.micronaut.core.annotation.AnnotationSource",
"reason": "Not needed anymore due to migration to HiveMQ MQTT client"
},
{
"type": "io.micronaut.mqtt.ssl.$MqttConfigurationEventListener$Definition$Reference",
"member": "Implemented interface io.micronaut.inject.BeanContextConditional",
"reason": "Not needed anymore due to migration to HiveMQ MQTT client"
},
{
"type": "io.micronaut.mqtt.ssl.$MqttConfigurationEventListener$Definition$Reference",
"member": "Implemented interface io.micronaut.core.annotation.AnnotationMetadataProvider",
"reason": "Not needed anymore due to migration to HiveMQ MQTT client"
},
{
"type": "io.micronaut.mqtt.ssl.$MqttConfigurationEventListener$Definition$Reference",
"member": "Implemented interface io.micronaut.inject.BeanType",
"reason": "Not needed anymore due to migration to HiveMQ MQTT client"
},
{
"type": "io.micronaut.mqtt.ssl.$MqttConfigurationEventListener$Definition$Reference",
"member": "Implemented interface io.micronaut.inject.BeanDefinitionReference",
"reason": "Not needed anymore due to migration to HiveMQ MQTT client"
}
]
8 changes: 8 additions & 0 deletions mqtt-bom/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
plugins {
id "io.micronaut.build.internal.bom"
}

micronautBom {
suppressions {
// Ignore binary compat for testing
acceptedLibraryRegressions.add('micronaut-mqttv3')
acceptedLibraryRegressions.add('micronaut-mqttv5')
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2022 original authors
* Copyright 2017-2023 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
153 changes: 153 additions & 0 deletions mqtt-core/src/main/java/io/micronaut/mqtt/bind/MqttMessage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/*
* Copyright 2017-2023 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.mqtt.bind;

/**
* A MQTT message holds the payload and options
* for message delivery.
*
* @author Sven Kobow
*/
public class MqttMessage {

private boolean mutable = true;
private byte[] payload;
private int qos = 1;
private boolean retained = false;
private boolean dup = false;
private int messageId;
private MqttProperties properties;

public MqttMessage() {
setPayload(new byte[]{});
}

public MqttMessage(final byte[] payload) {
setPayload(payload);
}

/**
* Returns whether the message is mutable.
* @return mutable
*/
public boolean getMutable() {
return mutable;
}

/**
* Sets whether the message is mutable.
* @param mutable boolean value
*/
public void setMutable(final boolean mutable) {
this.mutable = mutable;
}

/**
* Returns the payload as byte array.
* @return payload The payload byte array
*/
public byte[] getPayload() {
return payload;
}

/**
* Sets the payload of the message.
* @param payload The payload as byte array
*/
public void setPayload(final byte[] payload) {
this.payload = payload;
}

/**
* Returns the quality of service level for the message.
* @return MQTT quality of service level
*/
public int getQos() {
return qos;
}

/**
* Sets the quality of service level for the message.
* @param qos MQTT quality of service level
*/
public void setQos(final int qos) {
this.qos = qos;
}

/**
* Returns whether the message is a retained message.
* @return boolean value
*/
public boolean isRetained() {
return retained;
}

/**
* Sets whether the message is retained.
* @param retained boolean value
*/
public void setRetained(final boolean retained) {
this.retained = retained;
}

/**
* Returns whether the message is flagged as duplicate.
* @return boolean value
*/
public boolean getDup() {
return dup;
}

/**
* Flags the message as duplicate.
* @param dup boolean value
*/
public void setDup(final boolean dup) {
this.dup = dup;
}

/**
* Returns the message id.
* @return message id
*/
public int getId() {
return messageId;
}

/**
* Sets the message id.
* @param messageId message id
*/
public void setId(final int messageId) {
this.messageId = messageId;
}

/**
* Sets the MQTT message properties including user properties.
* @param properties MQTT message properties
*/
public void setProperties(final MqttProperties properties) {
this.properties = properties;
}

/**
* Returns the MQTT message properties including user properties.
* @return MQTT message properties
*/
public MqttProperties getProperties() {
return this.properties;
}
}
52 changes: 52 additions & 0 deletions mqtt-core/src/main/java/io/micronaut/mqtt/bind/MqttProperties.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright 2017-2023 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.mqtt.bind;

import java.util.ArrayList;
import java.util.List;

/**
* Represents MQTT v5 Properties including user properties.
*/
public class MqttProperties {

private byte[] correlationData;
private List<UserProperty> userProperties = new ArrayList<>();

/**
* User properties for MQTT v5 messages.
* @return a list of user defined properties
*/
public List<UserProperty> getUserProperties() {
return this.userProperties;
}

/**
* MQTT message correlation data.
* @param value Correlation data as byte array
*/
public void setCorrelationData(final byte[] value) {
this.correlationData = value;
}

/**
* MQTT message correlation data.
* @return correlation data as byte array
*/
public byte[] getCorrelationData() {
return this.correlationData;
}
}
45 changes: 45 additions & 0 deletions mqtt-core/src/main/java/io/micronaut/mqtt/bind/UserProperty.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright 2017-2023 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.mqtt.bind;

/**
* Represents a MQTT v5 property.
*/
public class UserProperty {
private final String key;
private final String value;

public UserProperty(String key, String value) {
this.key = key;
this.value = value;
}

/**
* The key of the property.
* @return the key
*/
public String getKey() {
return key;
}

/**
* The value of the property.
* @return the value
*/
public String getValue() {
return value;
}
}
Loading

0 comments on commit 75b69a3

Please sign in to comment.