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
No related branches found
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 { ...@@ -61,8 +61,10 @@ jar {
} }
from { from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
} }
archiveBaseName = 'ragconnect'
} }
task relast(type: JavaExec) { task relast(type: JavaExec) {
......
...@@ -53,7 +53,7 @@ public class MqttServerHandler { ...@@ -53,7 +53,7 @@ public class MqttServerHandler {
resolveHandler(uri).publish(extractTopic(uri), bytes, qos, retain); 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(); String path = uri.getPath();
if (path.charAt(0) == '/') { if (path.charAt(0) == '/') {
path = path.substring(1); path = path.substring(1);
......
#Wed Jul 29 16:29:05 CEST 2020 #Fri Aug 14 13:28:32 CEST 2020
version=0.2.0 version=0.2.1
private Runnable {{parentTypeName}}.{{sender}} = null; private Runnable {{parentTypeName}}.{{sender}} = null;
private byte[] {{parentTypeName}}.{{lastValue}} = 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}} {{>handleUri}}
switch (scheme) { switch (scheme) {
{{#usesMqtt}} {{#usesMqtt}}
case "mqtt": case "mqtt":
// MqttHandler handler = {{mqttHandlerAttribute}}().resolveHandler(uri);{{!optimize later}} final MqttHandler handler = {{mqttHandlerAttribute}}().resolveHandler(uri);
final String topic = {{mqttHandlerAttribute}}().extractTopic(uri);
{{sender}} = () -> { {{sender}} = () -> {
{{#loggingEnabledForWrites}} {{#loggingEnabledForWrites}}
System.out.println("[Send] {{tokenName}} = " + get{{tokenName}}() + " -> " + {{connectParameterName}}); System.out.println("[Send] {{tokenName}} = " + get{{tokenName}}() + " -> " + {{connectParameterName}});
{{/loggingEnabledForWrites}} {{/loggingEnabledForWrites}}
try { handler.publish(topic, {{lastValue}});
{{mqttHandlerAttribute}}().publish(uri, {{lastValue}});
} catch (java.io.IOException e) {
e.printStackTrace();
}
}; };
{{updateMethod}}(); {{updateMethod}}();
if (writeCurrentValue) { if (writeCurrentValue) {
......
...@@ -3,11 +3,9 @@ public {{parentTypeName}} {{parentTypeName}}.set{{name}}({{javaType}} value) { ...@@ -3,11 +3,9 @@ public {{parentTypeName}} {{parentTypeName}}.set{{name}}({{javaType}} value) {
{{#DependencyDefinitions}} {{#DependencyDefinitions}}
for ({{targetParentTypeName}} target : get{{internalRelationPrefix}}TargetList()) { for ({{targetParentTypeName}} target : get{{internalRelationPrefix}}TargetList()) {
{{#targetEndpointDefinition}} {{#targetEndpointDefinition}}
{{!#isPush}}
if (target.{{updateMethod}}()) { if (target.{{updateMethod}}()) {
target.{{writeMethod}}(); target.{{writeMethod}}();
} }
{{!/isPush}}
{{/targetEndpointDefinition}} {{/targetEndpointDefinition}}
} }
{{/DependencyDefinitions}} {{/DependencyDefinitions}}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment