Skip to content
Snippets Groups Projects
Commit abe8a70b authored by René Schöne's avatar René Schöne
Browse files

Update to version 0.2.1

- optimize mqtt-send performance (resolve handler only once)
parent 129dfb46
Branches
No related tags found
No related merge requests found
Pipeline #7610 passed
#!/bin/sh
echo "Old version: '$(./gradlew -q :ragconnect.base:run --args=--version)'"
if [ -z "$1" ]; then
echo "Missing parameter for version"
exit 1
fi
./gradlew newVersion -Pvalue=$1
......@@ -61,8 +61,10 @@ jar {
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
}
archiveBaseName = 'ragconnect'
}
task relast(type: JavaExec) {
......
......@@ -53,7 +53,7 @@ public class MqttServerHandler {
resolveHandler(uri).publish(extractTopic(uri), bytes, qos, retain);
}
private String extractTopic(java.net.URI uri) {
public static String extractTopic(java.net.URI uri) {
String path = uri.getPath();
if (path.charAt(0) == '/') {
path = path.substring(1);
......
#Wed Jul 29 16:29:05 CEST 2020
version=0.2.0
#Fri Aug 14 13:28:32 CEST 2020
version=0.2.1
private Runnable {{parentTypeName}}.{{sender}} = null;
private byte[] {{parentTypeName}}.{{lastValue}} = null;
public boolean {{parentTypeName}}.{{connectMethod}}(String {{connectParameterName}}, boolean writeCurrentValue) {
public boolean {{parentTypeName}}.{{connectMethod}}(String {{connectParameterName}}, boolean writeCurrentValue) throws java.io.IOException {
{{>handleUri}}
switch (scheme) {
{{#usesMqtt}}
case "mqtt":
// MqttHandler handler = {{mqttHandlerAttribute}}().resolveHandler(uri);{{!optimize later}}
final MqttHandler handler = {{mqttHandlerAttribute}}().resolveHandler(uri);
final String topic = {{mqttHandlerAttribute}}().extractTopic(uri);
{{sender}} = () -> {
{{#loggingEnabledForWrites}}
System.out.println("[Send] {{tokenName}} = " + get{{tokenName}}() + " -> " + {{connectParameterName}});
{{/loggingEnabledForWrites}}
try {
{{mqttHandlerAttribute}}().publish(uri, {{lastValue}});
} catch (java.io.IOException e) {
e.printStackTrace();
}
handler.publish(topic, {{lastValue}});
};
{{updateMethod}}();
if (writeCurrentValue) {
......
......@@ -3,11 +3,9 @@ public {{parentTypeName}} {{parentTypeName}}.set{{name}}({{javaType}} value) {
{{#DependencyDefinitions}}
for ({{targetParentTypeName}} target : get{{internalRelationPrefix}}TargetList()) {
{{#targetEndpointDefinition}}
{{!#isPush}}
if (target.{{updateMethod}}()) {
target.{{writeMethod}}();
}
{{!/isPush}}
{{/targetEndpointDefinition}}
}
{{/DependencyDefinitions}}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment