generated from micronaut-projects/micronaut-project-template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/hivemq-skeleton' into hivemq-ske…
…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
Showing
83 changed files
with
3,234 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
mqtt-core/src/main/java/io/micronaut/mqtt/bind/DefaultMqttBinderRegistry.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
153 changes: 153 additions & 0 deletions
153
mqtt-core/src/main/java/io/micronaut/mqtt/bind/MqttMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
52
mqtt-core/src/main/java/io/micronaut/mqtt/bind/MqttProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
45
mqtt-core/src/main/java/io/micronaut/mqtt/bind/UserProperty.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
Oops, something went wrong.