Skip to content

Commit

Permalink
Merge pull request #759 from hivemq/fix/reload
Browse files Browse the repository at this point in the history
Fixed reload logic
  • Loading branch information
codepitbull authored Jan 24, 2025
2 parents cbaf216 + 77a251c commit 9e41eb0
Show file tree
Hide file tree
Showing 61 changed files with 1,054 additions and 44 deletions.
3 changes: 3 additions & 0 deletions docker/DockerFile
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ RUN set -x \

COPY --from=unpack /opt/hivemq-edge-${HIVEMQ_EDGE_VERSION} /opt/hivemq-edge-${HIVEMQ_EDGE_VERSION}
COPY config.xml /opt/hivemq-edge-${HIVEMQ_EDGE_VERSION}/conf/config.xml
COPY config-k8s.xml /opt/hivemq-edge-${HIVEMQ_EDGE_VERSION}/conf-k8s/config.xml
COPY docker-entrypoint.sh /opt/docker-entrypoint.sh

RUN ln -s /opt/hivemq-edge-${HIVEMQ_EDGE_VERSION} /opt/hivemq \
&& groupadd --gid ${HIVEMQ_GID} hivemq \
&& useradd -g hivemq -d /opt/hivemq -s /bin/bash --uid ${HIVEMQ_UID} hivemq \
&& chgrp 0 /opt/hivemq-edge-${HIVEMQ_EDGE_VERSION}/conf/config.xml \
&& chmod 770 /opt/hivemq-edge-${HIVEMQ_EDGE_VERSION}/conf/config.xml \
&& chgrp 0 /opt/hivemq-edge-${HIVEMQ_EDGE_VERSION}/conf-k8s/config.xml \
&& chmod 770 /opt/hivemq-edge-${HIVEMQ_EDGE_VERSION}/conf-k8s/config.xml \
&& chgrp 0 /opt/hivemq \
&& chmod 770 /opt/hivemq \
&& chmod +x /opt/hivemq/bin/run.sh /opt/docker-entrypoint.sh
Expand Down
25 changes: 25 additions & 0 deletions docker/config-k8s.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<hivemq>
<mqtt-listeners>
<tcp-listener>
<port>1883</port>
<bind-address>0.0.0.0</bind-address>
</tcp-listener>
</mqtt-listeners>
<mqtt-sn-listeners>
<udp-listener>
<port>2442</port>
<bind-address>0.0.0.0</bind-address>
</udp-listener>
</mqtt-sn-listeners>
<admin-api>
<enabled>true</enabled>
<listeners>
<http-listener>
<bind-address>0.0.0.0</bind-address>
<port>8080</port>
</http-listener>
</listeners>
</admin-api>
${FRAGMENT:/fragment/config}
</hivemq>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import java.util.Objects;

/**
* @author Florian Limpöck
Expand All @@ -37,4 +38,17 @@ public boolean isEnabled() {
public void setEnabled(final boolean enabled) {
this.enabled = enabled;
}

@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DisabledEntity that = (DisabledEntity) o;
return isEnabled() == that.isEnabled();
}

@Override
public int hashCode() {
return Objects.hashCode(isEnabled());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Objects;

/**
* @author Simon L Johnson
Expand All @@ -41,4 +42,18 @@ public boolean isConfigurationExportEnabled() {
public boolean isMutableConfigurationEnabled() {
return mutableConfigurationEnabled;
}

@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final DynamicConfigEntity that = (DynamicConfigEntity) o;
return isConfigurationExportEnabled() == that.isConfigurationExportEnabled() &&
isMutableConfigurationEnabled() == that.isMutableConfigurationEnabled();
}

@Override
public int hashCode() {
return Objects.hash(isConfigurationExportEnabled(), isMutableConfigurationEnabled());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import java.util.Objects;

/**
* @author Florian Limpöck
Expand All @@ -37,4 +38,17 @@ public boolean isEnabled() {
public void setEnabled(final boolean enabled) {
this.enabled = enabled;
}

@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final EnabledEntity that = (EnabledEntity) o;
return isEnabled() == that.isEnabled();
}

@Override
public int hashCode() {
return Objects.hashCode(isEnabled());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,47 @@ public HiveMQConfigEntity(
public int getVersion() {
return version;
}

@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final HiveMQConfigEntity that = (HiveMQConfigEntity) o;
return getVersion() == that.getVersion() &&
Objects.equals(mqttListeners, that.mqttListeners) &&
Objects.equals(mqttsnListeners, that.mqttsnListeners) &&
Objects.equals(mqtt, that.mqtt) &&
Objects.equals(mqttsn, that.mqttsn) &&
Objects.equals(restrictions, that.restrictions) &&
Objects.equals(security, that.security) &&
Objects.equals(persistence, that.persistence) &&
Objects.equals(mqttBridges, that.mqttBridges) &&
Objects.equals(api, that.api) &&
Objects.equals(getUns(), that.getUns()) &&
Objects.equals(gateway, that.gateway) &&
Objects.equals(getUsageTracking(), that.getUsageTracking()) &&
Objects.equals(getProtocolAdapterConfig(), that.getProtocolAdapterConfig()) &&
Objects.equals(getModuleConfigs(), that.getModuleConfigs()) &&
Objects.equals(getInternal(), that.getInternal());
}

@Override
public int hashCode() {
return Objects.hash(getVersion(),
mqttListeners,
mqttsnListeners,
mqtt,
mqttsn,
restrictions,
security,
persistence,
mqttBridges,
api,
getUns(),
gateway,
getUsageTracking(),
getProtocolAdapterConfig(),
getModuleConfigs(),
getInternal());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
import java.util.Objects;

/**
* @author Christoph Schäbel
Expand All @@ -39,4 +40,17 @@ public class InternalConfigEntity {
public @NotNull List<OptionEntity> getOptions() {
return options;
}

@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final InternalConfigEntity that = (InternalConfigEntity) o;
return Objects.equals(getOptions(), that.getOptions());
}

@Override
public int hashCode() {
return Objects.hashCode(getOptions());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Objects;

/**
* @author Dominik Obermaier
Expand Down Expand Up @@ -114,4 +115,39 @@ public class MqttConfigEntity {
public @NotNull SharedSubscriptionsConfigEntity getSharedSubscriptionsConfigEntity() {
return sharedSubscriptionsConfigEntity;
}

@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final MqttConfigEntity that = (MqttConfigEntity) o;
return Objects.equals(getQueuedMessagesConfigEntity(), that.getQueuedMessagesConfigEntity()) &&
Objects.equals(getRetainedMessagesConfigEntity(), that.getRetainedMessagesConfigEntity()) &&
Objects.equals(getWildcardSubscriptionsConfigEntity(), that.getWildcardSubscriptionsConfigEntity()) &&
Objects.equals(getQoSConfigEntity(), that.getQoSConfigEntity()) &&
Objects.equals(getTopicAliasConfigEntity(), that.getTopicAliasConfigEntity()) &&
Objects.equals(getMessageExpiryConfigEntity(), that.getMessageExpiryConfigEntity()) &&
Objects.equals(getSessionExpiryConfigEntity(), that.getSessionExpiryConfigEntity()) &&
Objects.equals(getSubscriptionIdentifierConfigEntity(), that.getSubscriptionIdentifierConfigEntity()) &&
Objects.equals(getSharedSubscriptionsConfigEntity(), that.getSharedSubscriptionsConfigEntity()) &&
Objects.equals(getKeepAliveConfigEntity(), that.getKeepAliveConfigEntity()) &&
Objects.equals(getPacketsConfigEntity(), that.getPacketsConfigEntity()) &&
Objects.equals(getReceiveMaximumConfigEntity(), that.getReceiveMaximumConfigEntity());
}

@Override
public int hashCode() {
return Objects.hash(getQueuedMessagesConfigEntity(),
getRetainedMessagesConfigEntity(),
getWildcardSubscriptionsConfigEntity(),
getQoSConfigEntity(),
getTopicAliasConfigEntity(),
getMessageExpiryConfigEntity(),
getSessionExpiryConfigEntity(),
getSubscriptionIdentifierConfigEntity(),
getSharedSubscriptionsConfigEntity(),
getKeepAliveConfigEntity(),
getPacketsConfigEntity(),
getReceiveMaximumConfigEntity());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
* @author Simon L Johnson
Expand Down Expand Up @@ -96,4 +97,33 @@ public int getMaxClientIdentifierLength() {
public int getGatewayId() {
return gatewayId;
}

@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final MqttSnConfigEntity that = (MqttSnConfigEntity) o;
return getMaxClientIdentifierLength() == that.getMaxClientIdentifierLength() &&
getGatewayId() == that.getGatewayId() &&
Objects.equals(getPredefinedTopicAliases(), that.getPredefinedTopicAliases()) &&
Objects.equals(getAllowEmptyClientIdentifierEntity(), that.getAllowEmptyClientIdentifierEntity()) &&
Objects.equals(getDiscoveryEntity(), that.getDiscoveryEntity()) &&
Objects.equals(getAllowAnonymousPublishMinus1Entity(), that.getAllowAnonymousPublishMinus1Entity()) &&
Objects.equals(getAllowWakingPingToHijackSessionEntity(),
that.getAllowWakingPingToHijackSessionEntity()) &&
Objects.equals(getTopicRegistrationsHeldDuringSleepEntity(),
that.getTopicRegistrationsHeldDuringSleepEntity());
}

@Override
public int hashCode() {
return Objects.hash(getPredefinedTopicAliases(),
getAllowEmptyClientIdentifierEntity(),
getDiscoveryEntity(),
getAllowAnonymousPublishMinus1Entity(),
getAllowWakingPingToHijackSessionEntity(),
getTopicRegistrationsHeldDuringSleepEntity(),
getMaxClientIdentifierLength(),
getGatewayId());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Objects;

/**
* @author Christoph Schäbel
Expand All @@ -43,4 +44,17 @@ public class OptionEntity {
public @NotNull String getValue() {
return value;
}

@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final OptionEntity that = (OptionEntity) o;
return Objects.equals(getKey(), that.getKey()) && Objects.equals(getValue(), that.getValue());
}

@Override
public int hashCode() {
return Objects.hash(getKey(), getValue());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.jetbrains.annotations.NotNull;

import javax.xml.bind.annotation.*;
import java.util.Objects;

/**
* @author Lukas Brandl
Expand Down Expand Up @@ -53,5 +54,16 @@ public PersistenceMode getMode() {
return mode;
}

@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final PersistenceEntity that = (PersistenceEntity) o;
return getMode() == that.getMode();
}

@Override
public int hashCode() {
return Objects.hashCode(getMode());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import java.util.Objects;

import static com.hivemq.configuration.service.RestrictionsConfigurationService.*;

/**
Expand Down Expand Up @@ -67,4 +69,25 @@ public int getMaxTopicLength() {
public long getNoConnectIdleTimeout() {
return noConnectIdleTimeout;
}

@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final RestrictionsEntity that = (RestrictionsEntity) o;
return Objects.equals(getMaxConnections(), that.getMaxConnections()) &&
Objects.equals(getMaxClientIdLength(), that.getMaxClientIdLength()) &&
Objects.equals(getMaxTopicLength(), that.getMaxTopicLength()) &&
Objects.equals(getNoConnectIdleTimeout(), that.getNoConnectIdleTimeout()) &&
Objects.equals(getIncomingBandwidthThrottling(), that.getIncomingBandwidthThrottling());
}

@Override
public int hashCode() {
return Objects.hash(getMaxConnections(),
getMaxClientIdLength(),
getMaxTopicLength(),
getNoConnectIdleTimeout(),
getIncomingBandwidthThrottling());
}
}
Loading

0 comments on commit 9e41eb0

Please sign in to comment.