|
@@ -31,14 +31,15 @@ public class RabbitConsumer implements PojoRequestHandler<Map<String, Object>, V
|
|
|
@Override
|
|
@Override
|
|
|
public Void handleRequest(Map<String, Object> input, Context context) {
|
|
public Void handleRequest(Map<String, Object> input, Context context) {
|
|
|
log.info("函数计算启动, Request ID: {}, data:{}", context.getRequestId(), JacksonUtils.toJson(input));
|
|
log.info("函数计算启动, Request ID: {}, data:{}", context.getRequestId(), JacksonUtils.toJson(input));
|
|
|
- String queueName = input.get("queueName").toString();
|
|
|
|
|
|
|
+ Map<String, Object> payload = (Map<String, Object>) input.get("payload");
|
|
|
|
|
+ String queueName = payload.get("queueName").toString();
|
|
|
try (Connection connection = RabbitMQHelper.createConnection();
|
|
try (Connection connection = RabbitMQHelper.createConnection();
|
|
|
Channel channel = RabbitMQHelper.createChannel(connection, queueName)) {
|
|
Channel channel = RabbitMQHelper.createChannel(connection, queueName)) {
|
|
|
|
|
|
|
|
startConsumer(channel,queueName);
|
|
startConsumer(channel,queueName);
|
|
|
log.info("RabbitMQ 消费者启动成功");
|
|
log.info("RabbitMQ 消费者启动成功");
|
|
|
|
|
|
|
|
- Object val = input.get("waitSeconds");
|
|
|
|
|
|
|
+ Object val = payload.get("waitSeconds");
|
|
|
if (val instanceof Integer) {
|
|
if (val instanceof Integer) {
|
|
|
Thread.sleep(((int) val) * 1000);
|
|
Thread.sleep(((int) val) * 1000);
|
|
|
} else {
|
|
} else {
|