Skip to content

Commit 75b69a3

Browse files
committed
Merge remote-tracking branch 'origin/hivemq-skeleton' into hivemq-skeleton
# Conflicts: # mqtt-core/build.gradle # mqtt-hivemq-v3/build.gradle.kts # test-suite-utils/src/main/groovy/io/micronaut/mqtt/test/AbstractMQTTTest.groovy
2 parents 5630c25 + 2f527be commit 75b69a3

File tree

83 files changed

+3234
-165
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+3234
-165
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ bin/
2121
*.iws
2222
.kotlintest
2323
*/.kotlintest/
24+
.java-version
2425

2526
# ignore resources, are downloaded via a gradle task from micronaut_docs
2627
src/main/docs/resources/css/highlight/*.css

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
[![Build Status](https://github.com/micronaut-projects/micronaut-mqtt/workflows/Java%20CI/badge.svg)](https://github.com/micronaut-projects/micronaut-mqtt/actions)
55
[![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)
66

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

99
## Documentation
1010

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

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

buildSrc/src/main/groovy/io.micronaut.build.internal.graal-test.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ configurations.all {
1212
resolutionStrategy {
1313
force 'io.micronaut.platform:micronaut-platform:4.0.0-M4'
1414
}
15+
resolutionStrategy.preferProjectModules()
1516
}
1617

1718
dependencies {

config/accepted-api-changes.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,5 +153,80 @@
153153
"type": "io.micronaut.mqtt.v5.annotation.MqttPublisher",
154154
"member": "Implemented interface java.lang.annotation.Annotation",
155155
"reason": "Moved to core for Micronaut 4.0.0"
156+
},
157+
{
158+
"type": "io.micronaut.mqtt.ssl.$MqttCertificateConfiguration$Definition$Reference",
159+
"member": "Field $ANNOTATION_METADATA",
160+
"reason": "Migration to HiveMQ MQTT client"
161+
},
162+
{
163+
"type": "io.micronaut.mqtt.ssl.$MqttCertificateConfiguration$Definition$Reference",
164+
"member": "Constructor io.micronaut.mqtt.ssl.$MqttCertificateConfiguration$Definition$Reference()",
165+
"reason": "Migration to HiveMQ MQTT client"
166+
},
167+
{
168+
"type": "io.micronaut.mqtt.ssl.$MqttCertificateConfiguration$Definition$Reference",
169+
"member": "Implemented interface io.micronaut.core.annotation.AnnotationSource",
170+
"reason": "Migration to HiveMQ MQTT client"
171+
},
172+
{
173+
"type": "io.micronaut.mqtt.ssl.$MqttCertificateConfiguration$Definition$Reference",
174+
"member": "Implemented interface io.micronaut.inject.BeanContextConditional",
175+
"reason": "Migration to HiveMQ MQTT client"
176+
},
177+
{
178+
"type": "io.micronaut.mqtt.ssl.$MqttCertificateConfiguration$Definition$Reference",
179+
"member": "Implemented interface io.micronaut.core.annotation.AnnotationMetadataProvider",
180+
"reason": "Migration to HiveMQ MQTT client"
181+
},
182+
{
183+
"type": "io.micronaut.mqtt.ssl.$MqttCertificateConfiguration$Definition$Reference",
184+
"member": "Implemented interface io.micronaut.inject.BeanType",
185+
"reason": "Migration to HiveMQ MQTT client"
186+
},
187+
{
188+
"type": "io.micronaut.mqtt.ssl.$MqttCertificateConfiguration$Definition$Reference",
189+
"member": "Implemented interface io.micronaut.inject.BeanDefinitionReference",
190+
"reason": "Migration to HiveMQ MQTT client"
191+
},
192+
{
193+
"type": "io.micronaut.mqtt.ssl.MqttCertificateConfiguration",
194+
"member": "Constructor io.micronaut.mqtt.ssl.MqttCertificateConfiguration()",
195+
"reason": "Migration to HiveMQ MQTT client"
196+
},
197+
{
198+
"type": "io.micronaut.mqtt.ssl.$MqttConfigurationEventListener$Definition$Reference",
199+
"member": "Field $ANNOTATION_METADATA",
200+
"reason": "Provide a human readable reason for the change"
201+
},
202+
{
203+
"type": "io.micronaut.mqtt.ssl.$MqttConfigurationEventListener$Definition$Reference",
204+
"member": "Constructor io.micronaut.mqtt.ssl.$MqttConfigurationEventListener$Definition$Reference()",
205+
"reason": "Not needed anymore due to migration to HiveMQ MQTT client"
206+
},
207+
{
208+
"type": "io.micronaut.mqtt.ssl.$MqttConfigurationEventListener$Definition$Reference",
209+
"member": "Implemented interface io.micronaut.core.annotation.AnnotationSource",
210+
"reason": "Not needed anymore due to migration to HiveMQ MQTT client"
211+
},
212+
{
213+
"type": "io.micronaut.mqtt.ssl.$MqttConfigurationEventListener$Definition$Reference",
214+
"member": "Implemented interface io.micronaut.inject.BeanContextConditional",
215+
"reason": "Not needed anymore due to migration to HiveMQ MQTT client"
216+
},
217+
{
218+
"type": "io.micronaut.mqtt.ssl.$MqttConfigurationEventListener$Definition$Reference",
219+
"member": "Implemented interface io.micronaut.core.annotation.AnnotationMetadataProvider",
220+
"reason": "Not needed anymore due to migration to HiveMQ MQTT client"
221+
},
222+
{
223+
"type": "io.micronaut.mqtt.ssl.$MqttConfigurationEventListener$Definition$Reference",
224+
"member": "Implemented interface io.micronaut.inject.BeanType",
225+
"reason": "Not needed anymore due to migration to HiveMQ MQTT client"
226+
},
227+
{
228+
"type": "io.micronaut.mqtt.ssl.$MqttConfigurationEventListener$Definition$Reference",
229+
"member": "Implemented interface io.micronaut.inject.BeanDefinitionReference",
230+
"reason": "Not needed anymore due to migration to HiveMQ MQTT client"
156231
}
157232
]

mqtt-bom/build.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
plugins {
22
id "io.micronaut.build.internal.bom"
33
}
4+
5+
micronautBom {
6+
suppressions {
7+
// Ignore binary compat for testing
8+
acceptedLibraryRegressions.add('micronaut-mqttv3')
9+
acceptedLibraryRegressions.add('micronaut-mqttv5')
10+
}
11+
}

mqtt-core/src/main/java/io/micronaut/mqtt/bind/DefaultMqttBinderRegistry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2022 original authors
2+
* Copyright 2017-2023 original authors
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
/*
2+
* Copyright 2017-2023 original authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.micronaut.mqtt.bind;
17+
18+
/**
19+
* A MQTT message holds the payload and options
20+
* for message delivery.
21+
*
22+
* @author Sven Kobow
23+
*/
24+
public class MqttMessage {
25+
26+
private boolean mutable = true;
27+
private byte[] payload;
28+
private int qos = 1;
29+
private boolean retained = false;
30+
private boolean dup = false;
31+
private int messageId;
32+
private MqttProperties properties;
33+
34+
public MqttMessage() {
35+
setPayload(new byte[]{});
36+
}
37+
38+
public MqttMessage(final byte[] payload) {
39+
setPayload(payload);
40+
}
41+
42+
/**
43+
* Returns whether the message is mutable.
44+
* @return mutable
45+
*/
46+
public boolean getMutable() {
47+
return mutable;
48+
}
49+
50+
/**
51+
* Sets whether the message is mutable.
52+
* @param mutable boolean value
53+
*/
54+
public void setMutable(final boolean mutable) {
55+
this.mutable = mutable;
56+
}
57+
58+
/**
59+
* Returns the payload as byte array.
60+
* @return payload The payload byte array
61+
*/
62+
public byte[] getPayload() {
63+
return payload;
64+
}
65+
66+
/**
67+
* Sets the payload of the message.
68+
* @param payload The payload as byte array
69+
*/
70+
public void setPayload(final byte[] payload) {
71+
this.payload = payload;
72+
}
73+
74+
/**
75+
* Returns the quality of service level for the message.
76+
* @return MQTT quality of service level
77+
*/
78+
public int getQos() {
79+
return qos;
80+
}
81+
82+
/**
83+
* Sets the quality of service level for the message.
84+
* @param qos MQTT quality of service level
85+
*/
86+
public void setQos(final int qos) {
87+
this.qos = qos;
88+
}
89+
90+
/**
91+
* Returns whether the message is a retained message.
92+
* @return boolean value
93+
*/
94+
public boolean isRetained() {
95+
return retained;
96+
}
97+
98+
/**
99+
* Sets whether the message is retained.
100+
* @param retained boolean value
101+
*/
102+
public void setRetained(final boolean retained) {
103+
this.retained = retained;
104+
}
105+
106+
/**
107+
* Returns whether the message is flagged as duplicate.
108+
* @return boolean value
109+
*/
110+
public boolean getDup() {
111+
return dup;
112+
}
113+
114+
/**
115+
* Flags the message as duplicate.
116+
* @param dup boolean value
117+
*/
118+
public void setDup(final boolean dup) {
119+
this.dup = dup;
120+
}
121+
122+
/**
123+
* Returns the message id.
124+
* @return message id
125+
*/
126+
public int getId() {
127+
return messageId;
128+
}
129+
130+
/**
131+
* Sets the message id.
132+
* @param messageId message id
133+
*/
134+
public void setId(final int messageId) {
135+
this.messageId = messageId;
136+
}
137+
138+
/**
139+
* Sets the MQTT message properties including user properties.
140+
* @param properties MQTT message properties
141+
*/
142+
public void setProperties(final MqttProperties properties) {
143+
this.properties = properties;
144+
}
145+
146+
/**
147+
* Returns the MQTT message properties including user properties.
148+
* @return MQTT message properties
149+
*/
150+
public MqttProperties getProperties() {
151+
return this.properties;
152+
}
153+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright 2017-2023 original authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.micronaut.mqtt.bind;
17+
18+
import java.util.ArrayList;
19+
import java.util.List;
20+
21+
/**
22+
* Represents MQTT v5 Properties including user properties.
23+
*/
24+
public class MqttProperties {
25+
26+
private byte[] correlationData;
27+
private List<UserProperty> userProperties = new ArrayList<>();
28+
29+
/**
30+
* User properties for MQTT v5 messages.
31+
* @return a list of user defined properties
32+
*/
33+
public List<UserProperty> getUserProperties() {
34+
return this.userProperties;
35+
}
36+
37+
/**
38+
* MQTT message correlation data.
39+
* @param value Correlation data as byte array
40+
*/
41+
public void setCorrelationData(final byte[] value) {
42+
this.correlationData = value;
43+
}
44+
45+
/**
46+
* MQTT message correlation data.
47+
* @return correlation data as byte array
48+
*/
49+
public byte[] getCorrelationData() {
50+
return this.correlationData;
51+
}
52+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright 2017-2023 original authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.micronaut.mqtt.bind;
17+
18+
/**
19+
* Represents a MQTT v5 property.
20+
*/
21+
public class UserProperty {
22+
private final String key;
23+
private final String value;
24+
25+
public UserProperty(String key, String value) {
26+
this.key = key;
27+
this.value = value;
28+
}
29+
30+
/**
31+
* The key of the property.
32+
* @return the key
33+
*/
34+
public String getKey() {
35+
return key;
36+
}
37+
38+
/**
39+
* The value of the property.
40+
* @return the value
41+
*/
42+
public String getValue() {
43+
return value;
44+
}
45+
}

0 commit comments

Comments
 (0)