From 0313786a4764e6c1302ae3af6050c5eb48b37a78 Mon Sep 17 00:00:00 2001 From: "chen.ma" Date: Thu, 19 May 2022 23:17:01 +0800 Subject: [PATCH] Add spring cloud stream rocketmq thread pool to adapt to open source protocol --- ...rSpringCloudStreamRocketMQApplication.java | 17 ++++++++++++++ .../rocketmq/example/MessageConsume.java | 23 +++++++++++++++++-- .../rocketmq/example/MessageProduce.java | 17 ++++++++++++++ .../stream/rocketmq/example/MySink.java | 17 ++++++++++++++ 4 files changed, 72 insertions(+), 2 deletions(-) diff --git a/hippo4j-example/hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq-example/src/main/java/cn/hippo4j/springboot/starter/adapter/springcloud/stream/rocketmq/example/Hippo4jAdapterSpringCloudStreamRocketMQApplication.java b/hippo4j-example/hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq-example/src/main/java/cn/hippo4j/springboot/starter/adapter/springcloud/stream/rocketmq/example/Hippo4jAdapterSpringCloudStreamRocketMQApplication.java index e0ddd799..63555dc9 100644 --- a/hippo4j-example/hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq-example/src/main/java/cn/hippo4j/springboot/starter/adapter/springcloud/stream/rocketmq/example/Hippo4jAdapterSpringCloudStreamRocketMQApplication.java +++ b/hippo4j-example/hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq-example/src/main/java/cn/hippo4j/springboot/starter/adapter/springcloud/stream/rocketmq/example/Hippo4jAdapterSpringCloudStreamRocketMQApplication.java @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package cn.hippo4j.springboot.starter.adapter.springcloud.stream.rocketmq.example; import cn.hippo4j.core.enable.EnableDynamicThreadPool; diff --git a/hippo4j-example/hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq-example/src/main/java/cn/hippo4j/springboot/starter/adapter/springcloud/stream/rocketmq/example/MessageConsume.java b/hippo4j-example/hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq-example/src/main/java/cn/hippo4j/springboot/starter/adapter/springcloud/stream/rocketmq/example/MessageConsume.java index 4ad846c0..6ba5d918 100644 --- a/hippo4j-example/hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq-example/src/main/java/cn/hippo4j/springboot/starter/adapter/springcloud/stream/rocketmq/example/MessageConsume.java +++ b/hippo4j-example/hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq-example/src/main/java/cn/hippo4j/springboot/starter/adapter/springcloud/stream/rocketmq/example/MessageConsume.java @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package cn.hippo4j.springboot.starter.adapter.springcloud.stream.rocketmq.example; import cn.hippo4j.example.core.dto.SendMessageDTO; @@ -23,7 +40,8 @@ public class MessageConsume { try { // ignore } finally { - log.info("Keys: {}, Msg id: {}, Execute time: {} ms, Message: {}", headers.get("rocketmq_KEYS"), headers.get("rocketmq_MESSAGE_ID"), System.currentTimeMillis() - startTime, JSON.toJSONString(message)); + log.info("Keys: {}, Msg id: {}, Execute time: {} ms, Message: {}", headers.get("rocketmq_KEYS"), headers.get("rocketmq_MESSAGE_ID"), System.currentTimeMillis() - startTime, + JSON.toJSONString(message)); } log.info("Input current thread name: {}", Thread.currentThread().getName()); } @@ -34,7 +52,8 @@ public class MessageConsume { try { // ignore } finally { - log.info("Keys: {}, Msg id: {}, Execute time: {} ms, Message: {}", headers.get("rocketmq_KEYS"), headers.get("rocketmq_MESSAGE_ID"), System.currentTimeMillis() - startTime, JSON.toJSONString(message)); + log.info("Keys: {}, Msg id: {}, Execute time: {} ms, Message: {}", headers.get("rocketmq_KEYS"), headers.get("rocketmq_MESSAGE_ID"), System.currentTimeMillis() - startTime, + JSON.toJSONString(message)); } log.info("Input2 current thread name: {}", Thread.currentThread().getName()); } diff --git a/hippo4j-example/hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq-example/src/main/java/cn/hippo4j/springboot/starter/adapter/springcloud/stream/rocketmq/example/MessageProduce.java b/hippo4j-example/hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq-example/src/main/java/cn/hippo4j/springboot/starter/adapter/springcloud/stream/rocketmq/example/MessageProduce.java index 9593f433..83370a67 100644 --- a/hippo4j-example/hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq-example/src/main/java/cn/hippo4j/springboot/starter/adapter/springcloud/stream/rocketmq/example/MessageProduce.java +++ b/hippo4j-example/hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq-example/src/main/java/cn/hippo4j/springboot/starter/adapter/springcloud/stream/rocketmq/example/MessageProduce.java @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package cn.hippo4j.springboot.starter.adapter.springcloud.stream.rocketmq.example; import cn.hippo4j.example.core.dto.SendMessageDTO; diff --git a/hippo4j-example/hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq-example/src/main/java/cn/hippo4j/springboot/starter/adapter/springcloud/stream/rocketmq/example/MySink.java b/hippo4j-example/hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq-example/src/main/java/cn/hippo4j/springboot/starter/adapter/springcloud/stream/rocketmq/example/MySink.java index 22640300..d3dd3180 100644 --- a/hippo4j-example/hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq-example/src/main/java/cn/hippo4j/springboot/starter/adapter/springcloud/stream/rocketmq/example/MySink.java +++ b/hippo4j-example/hippo4j-spring-boot-starter-adapter-spring-cloud-stream-rocketmq-example/src/main/java/cn/hippo4j/springboot/starter/adapter/springcloud/stream/rocketmq/example/MySink.java @@ -1,3 +1,20 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package cn.hippo4j.springboot.starter.adapter.springcloud.stream.rocketmq.example; import org.springframework.cloud.stream.annotation.Input;