Skip to content

Commit

Permalink
Upgrade to Hono 1.3.0-M3 (EnMasseProject#4419)
Browse files Browse the repository at this point in the history
  • Loading branch information
dejanb authored Jun 29, 2020
1 parent 280e357 commit e84922b
Showing 36 changed files with 351 additions and 494 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@

package io.enmasse.iot.registry.devcon;

import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -24,7 +25,7 @@ public abstract class AbstractDeviceConnectionService implements DeviceConnectio

protected abstract Future<DeviceConnectionResult> processGetLastKnownGatewayForDevice(final DeviceConnectionKey key, final Span span);

protected abstract Future<DeviceConnectionResult> processSetCommandHandlingAdapterInstance(final DeviceConnectionKey key, final String adapterInstanceId, final Span span);
protected abstract Future<DeviceConnectionResult> processSetCommandHandlingAdapterInstance(final DeviceConnectionKey key, final String adapterInstanceId, Duration lifespan, final Span span);

protected abstract Future<DeviceConnectionResult> processGetCommandHandlingAdapterInstances(final DeviceConnectionKey key, final List<String> viaGateways, final Span span);

@@ -43,8 +44,8 @@ public Future<DeviceConnectionResult> setLastKnownGatewayForDevice(final String
}

@Override
public Future<DeviceConnectionResult> setCommandHandlingAdapterInstance(String tenantId, String deviceId, String adapterInstanceId, Span span) {
return processSetCommandHandlingAdapterInstance(DeviceConnectionKey.deviceConnectionKey(tenantId, deviceId), adapterInstanceId, span);
public Future<DeviceConnectionResult> setCommandHandlingAdapterInstance(String tenantId, String deviceId, String adapterInstanceId, Duration lifespan, Span span) {
return processSetCommandHandlingAdapterInstance(DeviceConnectionKey.deviceConnectionKey(tenantId, deviceId), adapterInstanceId, lifespan, span);
}

@Override
Original file line number Diff line number Diff line change
@@ -30,7 +30,6 @@
import io.opentracing.Span;
import io.vertx.core.Future;

@Component
public class KubernetesTenantInformationService extends AbstractProjectBasedService implements TenantInformationService {

private static final Logger log = LoggerFactory.getLogger(KubernetesTenantInformationService.class);

This file was deleted.

7 changes: 0 additions & 7 deletions iot/iot-device-registry-infinispan/pom.xml
Original file line number Diff line number Diff line change
@@ -86,13 +86,6 @@
<artifactId>vertx-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.hono</groupId>
<artifactId>hono-service-base</artifactId>
<classifier>tests</classifier>
<type>test-jar</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.infinispan</groupId>
Original file line number Diff line number Diff line change
@@ -21,11 +21,8 @@
import io.vertx.core.Verticle;

@ComponentScan("org.eclipse.hono.service.auth")
@ComponentScan("org.eclipse.hono.deviceregistry.service.deviceconnection")
@ComponentScan("org.eclipse.hono.service.metric")
@ComponentScan("io.enmasse.iot.registry")
@ComponentScan("io.enmasse.iot.service.base")
@ComponentScan("io.enmasse.iot.infinispan")
@ComponentScan("io.enmasse.iot.registry.infinispan.config")
@EnableAutoConfiguration
public class Application extends AbstractBaseApplication {

Original file line number Diff line number Diff line change
@@ -11,7 +11,9 @@
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

import io.enmasse.iot.registry.server.DeviceRegistryAmqpServer;
import io.enmasse.iot.utils.ConfigBase;

@Configuration
@@ -29,4 +31,15 @@ public ServiceConfigProperties amqpProperties() {
return new ServiceConfigProperties();
}

/**
* Creates a new server for exposing the device registry's AMQP 1.0 based
* endpoints.
*
* @return The server.
*/
@Bean
public DeviceRegistryAmqpServer amqpServer() {
return new DeviceRegistryAmqpServer();
}

}
Original file line number Diff line number Diff line change
@@ -5,37 +5,50 @@

package io.enmasse.iot.registry.infinispan.config;

import static io.enmasse.iot.registry.infinispan.Profiles.PROFILE_DEVICE_CONNECTION;
import static io.vertx.core.Vertx.vertx;

import org.eclipse.hono.deviceregistry.service.deviceconnection.MapBasedDeviceConnectionService;
import org.eclipse.hono.deviceregistry.service.deviceconnection.MapBasedDeviceConnectionsConfigProperties;
import org.eclipse.hono.service.deviceconnection.DeviceConnectionAmqpEndpoint;
import org.eclipse.hono.service.amqp.AmqpEndpoint;
import org.eclipse.hono.service.deviceconnection.DelegatingDeviceConnectionAmqpEndpoint;
import org.eclipse.hono.service.deviceconnection.DeviceConnectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import io.vertx.core.Vertx;
import org.springframework.context.annotation.Profile;

@Configuration
//@Profile(PROFILE_DEVICE_CONNECTION)
//TODO - enable it again when https://github.com/EnMasseProject/enmasse/issues/4338 is implemented
@Profile(PROFILE_DEVICE_CONNECTION)
public class DeviceConnectionServiceConfiguration {

/**
* Creates a new instance of an AMQP 1.0 protocol handler for Hono's <em>Device Connection</em> API.
*
* @param service The service instance to delegate to.
* @return The handler.
*/
@Autowired
@Bean
@ConditionalOnBean(DeviceConnectionService.class)
public DeviceConnectionAmqpEndpoint deviceConnectionAmqpEndpoint(final Vertx vertx) {
return new DeviceConnectionAmqpEndpoint(vertx);
public AmqpEndpoint deviceConnectionAmqpEndpoint(final DeviceConnectionService service) {
return new DelegatingDeviceConnectionAmqpEndpoint<DeviceConnectionService>(vertx(), service);
}

@Bean
//TODO - remove when https://github.com/EnMasseProject/enmasse/issues/4338 is implemented
public MapBasedDeviceConnectionsConfigProperties deviceConnectionsProperties() {
public MapBasedDeviceConnectionsConfigProperties deviceConnectionProperties() {
return new MapBasedDeviceConnectionsConfigProperties();
}

/**
* Creates an instance of the file based service for managing device connection information.
*
* @return The service.
*/
@Bean
public DeviceConnectionService deviceConnectionService() {
final MapBasedDeviceConnectionService service = new MapBasedDeviceConnectionService();
service.setConfig(deviceConnectionProperties());
return service;
}

}
Loading

0 comments on commit e84922b

Please sign in to comment.