Prepared cloud deployment of hawkbit sandbox
This commit is contained in:
21
examples/hawkbit-device-simulator/cf/manifest.yml
Normal file
21
examples/hawkbit-device-simulator/cf/manifest.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
---
|
||||
applications:
|
||||
- name: hawkbit-simulator
|
||||
memory: 512M
|
||||
instances: 1
|
||||
buildpack: https://github.com/cloudfoundry/java-buildpack
|
||||
path: hawkbit-example-app-0.2.0-SNAPSHOT.jar
|
||||
services:
|
||||
- dmf-rabbit
|
||||
env:
|
||||
SPRING_PROFILES_ACTIVE: cloudsandbox,amqp
|
||||
CF_STAGING_TIMEOUT: 15
|
||||
CF_STARTUP_TIMEOUT: 15
|
||||
@@ -42,6 +42,16 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>cf</directory>
|
||||
<filtering>true</filtering>
|
||||
<targetPath>${project.build.directory}</targetPath>
|
||||
<includes>
|
||||
<include>manifest.yml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.eclipse.hawkbit.simulator.AbstractSimulatedDevice.Protocol;
|
||||
import org.eclipse.hawkbit.simulator.amqp.SpSenderService;
|
||||
import org.eclipse.hawkbit.simulator.event.InitUpdate;
|
||||
import org.eclipse.hawkbit.simulator.event.ProgressUpdate;
|
||||
@@ -34,6 +35,9 @@ public class DeviceSimulatorUpdater {
|
||||
@Autowired
|
||||
private SpSenderService spSenderService;
|
||||
|
||||
@Autowired
|
||||
private SimulatedDeviceFactory deviceFactory;
|
||||
|
||||
@Autowired
|
||||
private EventBus eventbus;
|
||||
|
||||
@@ -58,7 +62,13 @@ public class DeviceSimulatorUpdater {
|
||||
*/
|
||||
public void startUpdate(final String tenant, final String id, final long actionId, final String swVersion,
|
||||
final UpdaterCallback callback) {
|
||||
final AbstractSimulatedDevice device = repository.get(tenant, id);
|
||||
AbstractSimulatedDevice device = repository.get(tenant, id);
|
||||
|
||||
// plug and play - non existing device will be auto created
|
||||
if (device == null) {
|
||||
device = repository.add(deviceFactory.createSimulatedDevice(id, tenant, Protocol.DMF_AMQP, -1, null, null));
|
||||
}
|
||||
|
||||
device.setProgress(0.0);
|
||||
device.setSwversion(swVersion);
|
||||
eventbus.post(new InitUpdate(device));
|
||||
|
||||
@@ -59,7 +59,8 @@ public class AmqpConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the receiver queue from sp. Receive messages from sp.
|
||||
* Creates the receiver queue from update server for receiving message from
|
||||
* update server.
|
||||
*
|
||||
* @return the queue
|
||||
*/
|
||||
@@ -70,7 +71,7 @@ public class AmqpConfiguration {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the recevier exchange. Sp send messages to this exchange.
|
||||
* Creates the receiver exchange for sending messages to update server.
|
||||
*
|
||||
* @return the exchange
|
||||
*/
|
||||
|
||||
@@ -26,9 +26,7 @@ import org.springframework.messaging.handler.annotation.Header;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Handle all incoming Messages from SP.
|
||||
*
|
||||
*
|
||||
* Handle all incoming Messages from hawkBit update server.
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@@ -44,17 +42,6 @@ public class SpReceiverService extends ReceiverService {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param rabbitTemplate
|
||||
* the rabbit template
|
||||
* @param amqpProperties
|
||||
* the amqp properties
|
||||
* @param lwm2mSenderService
|
||||
* the lwm2mSenderService
|
||||
* @param spSenderService
|
||||
* the spSenderService
|
||||
* @param deviceUpdater
|
||||
* the updater service to simulate update process
|
||||
*/
|
||||
@Autowired
|
||||
public SpReceiverService(final RabbitTemplate rabbitTemplate, final AmqpProperties amqpProperties,
|
||||
@@ -62,12 +49,11 @@ public class SpReceiverService extends ReceiverService {
|
||||
super(rabbitTemplate, amqpProperties);
|
||||
this.spSenderService = spSenderService;
|
||||
this.deviceUpdater = deviceUpdater;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the incoming Message from Queue with the property
|
||||
* (com.bosch.sp.lwm2m.connector.amqp.receiverConnectorQueueFromSp).
|
||||
* (hawkbit.device.simulator.amqp.receiverConnectorQueueFromSp).
|
||||
*
|
||||
* @param message
|
||||
* the incoming message
|
||||
|
||||
@@ -7,11 +7,7 @@
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
|
||||
|
||||
#########################################################################################
|
||||
# PUBLIC configuration, i.e. can be changed by users at runtime (defaults provided here)
|
||||
#########################################################################################
|
||||
## Configuration for RabbitMQ communication
|
||||
## Configuration for DMF communication
|
||||
hawkbit.device.simulator.amqp.receiverConnectorQueueFromSp=simulator_receiver
|
||||
hawkbit.device.simulator.amqp.deadLetterQueue=simulator_deadletter
|
||||
hawkbit.device.simulator.amqp.deadLetterExchange=simulator.deadletter
|
||||
|
||||
Reference in New Issue
Block a user