From a4ffd3ff257840a32336341853ce62666d32ff0b Mon Sep 17 00:00:00 2001 From: yanghq <1040926235@qq.com> Date: Fri, 30 Aug 2024 14:12:28 +0800 Subject: [PATCH] init --- README-zh.md | 108 +++++++++++++++++- README.md | 107 ++++++++++++++++- .../RedisBinderEnvironmentPostProcessor.java | 15 +++ .../RedisBinderConfigurationProperties.java | 15 +++ .../properties/RedisBindingProperties.java | 15 +++ .../properties/RedisConsumerProperties.java | 15 +++ .../RedisExtendedBindingProperties.java | 15 +++ .../properties/RedisProducerProperties.java | 15 +++ .../properties/RedisTopicProperties.java | 15 +++ .../provisioning/RedisTopicProvisioner.java | 20 +++- .../utils/RedisConnectionFactoryUtil.java | 18 ++- ...edisBinderConfigurationPropertiesTest.java | 15 +++ .../redis/RedisMessageChannelBinder.java | 15 +++ .../redis/aot/RedisBinderRuntimeHints.java | 76 +++++++----- ...gHandlerMappingsProviderConfiguration.java | 15 +++ .../config/RedisBinderConfiguration.java | 15 +++ docs/README.md | 27 +++++ docs/en/README.md | 29 +++++ gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 4 +- 21 files changed, 517 insertions(+), 41 deletions(-) create mode 100644 docs/README.md create mode 100644 docs/en/README.md diff --git a/README-zh.md b/README-zh.md index 3836afb..892ed5b 100644 --- a/README-zh.md +++ b/README-zh.md @@ -1,18 +1,124 @@ ## spring-cloud-stream-redis -[![Maven central](https://img.shields.io/maven-central/v/io.github.guoshiqiufeng/spring-cloud-stream-redis.svg?style=flat-square)](https://search.maven.org/search?q=g:io.github.guoshiqiufeng%20AND%20a:spring-cloud-stream-redis) +[![Maven central](https://img.shields.io/maven-central/v/io.github.guoshiqiufeng.cloud/spring-cloud-starter-stream-redis.svg?style=flat-square)](https://search.maven.org/search?q=g:io.github.guoshiqiufeng%20AND%20a:spring-cloud-starter-stream-redis) [![License](https://img.shields.io/:license-apache-brightgreen.svg?style=flat-square)](http://www.apache.org/licenses/LICENSE-2.0.html) 阅读其他语言版本: [English](README.md) ### 介绍 +基于Spring Cloud Stream 规范实现 Redis 消息 发送、接收 + ### 文档 + + ### 开发框架 +- Spring Cloud 2023.0.3 +- Spring Boot 3.2.7 + ### 功能 +- PUBLISH SUBSCRIBE 消息 +- QUEUE 消息(BLPOP BRPOP LPUSH RPUSH) + +> 注1: 两个功能模式不能混合使用,即 使用 PUBLISH SUBSCRIBE 模式 发送消息 时,不能使用 QUEUE 模式接收消息,反之亦然 + +> 注2: PUBLISH SUBSCRIBE 模式消息接收不到会丢失,QUEUE 模式不会 + ### 使用 +#### 引入统一版本依赖,不用再使用时指定版本号 +```xml + + + + io.github.guoshiqiufeng.cloud + spring-cloud-stream-dependencies + 0.1.0 + import + + + +``` + +#### 引入starter依赖 + +```xml + + io.github.guoshiqiufeng.cloud + spring-cloud-starter-stream-redis + +``` + +#### yml 配置 + +```yaml +spring: + cloud: + stream: + default-binder: redis + binders: + redis: + type: redis + redis: + binder: + configuration: + host: 127.0.0.1 + port: 6379 + password: 123456 + database: 7 + support-type: queue_channel +# bindings: +# send-in-0: +# consumer: +# destination-is-pattern: true + bindings: + out-0: + destination: test-topic + content-type: text/plain + group: push-producer-group + send-in-0: + destination: test-topic + content-type: text/plain + group: test-send-group +``` + +#### 消息发送 + +```java + @Autowired + private StreamBridge streamBridge; + + @GetMapping("/send") + public String send() { + MessageVO messageVO = new MessageVO(); + messageVO.setKey(UUID.randomUUID().toString()); + messageVO.setMsg("hello "); + messageVO.setIds(Set.of("1", "2")); + messageVO.setCreateTime(LocalDateTime.now()); + streamBridge.send("out-0", JSON.toJSONString(messageVO, JSONWriter.Feature.WriteClassName)); + return "success"; + } +``` + +### 消息接收 + +```java +@Slf4j +@Component("send") +public class MessageHandler implements Consumer> { + /** + * Performs this operation on the given argument. + * + * @param messageVOMessage the input argument + */ + @Override + public void accept(Message messageVOMessage) { + log.info("send Receive New Messages: {}", messageVOMessage.getPayload()); + } +} +``` +更多使用参考查看文档 diff --git a/README.md b/README.md index 2f9a8fb..aa6b09a 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,123 @@ ## spring-cloud-stream-redis -[![Maven central](https://img.shields.io/maven-central/v/io.github.guoshiqiufeng/spring-cloud-stream-redis.svg?style=flat-square)](https://search.maven.org/search?q=g:io.github.guoshiqiufeng%20AND%20a:loki) +[![Maven central](https://img.shields.io/maven-central/v/io.github.guoshiqiufeng.cloud/spring-cloud-stream-redis.svg?style=flat-square)](https://search.maven.org/search?q=g:io.github.guoshiqiufeng%20AND%20a:loki) [![License](https://img.shields.io/:license-apache-brightgreen.svg?style=flat-square)](http://www.apache.org/licenses/LICENSE-2.0.html) Read in other languages: [简体中文](README-zh.md) ### Introduction +Sending and Receiving Redis Messages Based on Spring Cloud Stream Specification + ### Documentation ### Development Framework +- Spring Cloud 2023.0.3 +- Spring Boot 3.2.7 + ### Features +- PUBLISH SUBSCRIBE message +- QUEUE message(BLPOP BRPOP LPUSH RPUSH) + +> Tips 1: The two function modes cannot be mixed, i.e., if you send a message in PUBLISH SUBSCRIBE mode, you cannot receive a message in QUEUE mode, and vice versa. + +> Tips 2: PUBLISH SUBSCRIBE mode messages will be lost if not received, QUEUE mode will not. + ### Use +#### Introduces a uniform version dependency, so you don't have to specify a version number when you use it. +```xml + + + + io.github.guoshiqiufeng.cloud + spring-cloud-stream-dependencies + 0.1.0 + import + + + +``` + +#### Introducing starter dependencies + +```xml + + io.github.guoshiqiufeng.cloud + spring-cloud-starter-stream-redis + +``` + +#### yml configuration + +```yaml +spring: + cloud: + stream: + default-binder: redis + binders: + redis: + type: redis + redis: + binder: + configuration: + host: 127.0.0.1 + port: 6379 + password: 123456 + database: 7 + support-type: queue_channel +# bindings: +# send-in-0: +# consumer: +# destination-is-pattern: true + bindings: + out-0: + destination: test-topic + content-type: text/plain + group: push-producer-group + send-in-0: + destination: test-topic + content-type: text/plain + group: test-send-group +``` + +#### Messaging + +```java + @Autowired + private StreamBridge streamBridge; + + @GetMapping("/send") + public String send() { + MessageVO messageVO = new MessageVO(); + messageVO.setKey(UUID.randomUUID().toString()); + messageVO.setMsg("hello "); + messageVO.setIds(Set.of("1", "2")); + messageVO.setCreateTime(LocalDateTime.now()); + streamBridge.send("out-0", JSON.toJSONString(messageVO, JSONWriter.Feature.WriteClassName)); + return "success"; + } +``` + +### Message reception + +```java +@Slf4j +@Component("send") +public class MessageHandler implements Consumer> { + + /** + * Performs this operation on the given argument. + * + * @param messageVOMessage the input argument + */ + @Override + public void accept(Message messageVOMessage) { + log.info("send Receive New Messages: {}", messageVOMessage.getPayload()); + } +} +``` +For more usage references check the documentation diff --git a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/common/RedisBinderEnvironmentPostProcessor.java b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/common/RedisBinderEnvironmentPostProcessor.java index 17978c3..5759e14 100644 --- a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/common/RedisBinderEnvironmentPostProcessor.java +++ b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/common/RedisBinderEnvironmentPostProcessor.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2023-2024, fubluesky (fubluesky@foxmail.com) + * + * Licensed 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 io.github.guoshiqiufeng.cloud.stream.binder.redis.common; import lombok.extern.slf4j.Slf4j; diff --git a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisBinderConfigurationProperties.java b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisBinderConfigurationProperties.java index 7f3f71a..99c0d3a 100644 --- a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisBinderConfigurationProperties.java +++ b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisBinderConfigurationProperties.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2023-2024, fubluesky (fubluesky@foxmail.com) + * + * Licensed 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 io.github.guoshiqiufeng.cloud.stream.binder.redis.properties; import lombok.Getter; diff --git a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisBindingProperties.java b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisBindingProperties.java index a09aa4f..9ce3674 100644 --- a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisBindingProperties.java +++ b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisBindingProperties.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2023-2024, fubluesky (fubluesky@foxmail.com) + * + * Licensed 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 io.github.guoshiqiufeng.cloud.stream.binder.redis.properties; import lombok.Data; diff --git a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisConsumerProperties.java b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisConsumerProperties.java index cb2d9d8..800e9b6 100644 --- a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisConsumerProperties.java +++ b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisConsumerProperties.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2023-2024, fubluesky (fubluesky@foxmail.com) + * + * Licensed 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 io.github.guoshiqiufeng.cloud.stream.binder.redis.properties; import lombok.Getter; diff --git a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisExtendedBindingProperties.java b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisExtendedBindingProperties.java index 0390e90..b8ace91 100644 --- a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisExtendedBindingProperties.java +++ b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisExtendedBindingProperties.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2023-2024, fubluesky (fubluesky@foxmail.com) + * + * Licensed 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 io.github.guoshiqiufeng.cloud.stream.binder.redis.properties; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisProducerProperties.java b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisProducerProperties.java index 471a0c4..efe7a10 100644 --- a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisProducerProperties.java +++ b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisProducerProperties.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2023-2024, fubluesky (fubluesky@foxmail.com) + * + * Licensed 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 io.github.guoshiqiufeng.cloud.stream.binder.redis.properties; /** diff --git a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisTopicProperties.java b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisTopicProperties.java index bdd9823..0e622e0 100644 --- a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisTopicProperties.java +++ b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisTopicProperties.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2023-2024, fubluesky (fubluesky@foxmail.com) + * + * Licensed 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 io.github.guoshiqiufeng.cloud.stream.binder.redis.properties; import lombok.Data; diff --git a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/provisioning/RedisTopicProvisioner.java b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/provisioning/RedisTopicProvisioner.java index 2292006..3583549 100644 --- a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/provisioning/RedisTopicProvisioner.java +++ b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/provisioning/RedisTopicProvisioner.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2023-2024, fubluesky (fubluesky@foxmail.com) + * + * Licensed 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 io.github.guoshiqiufeng.cloud.stream.binder.redis.provisioning; import io.github.guoshiqiufeng.cloud.stream.binder.redis.properties.RedisBinderConfigurationProperties; @@ -44,12 +59,7 @@ public class RedisTopicProvisioner implements */ public RedisTopicProvisioner( RedisBinderConfigurationProperties redisBinderConfigurationProperties) { - this.configurationProperties = redisBinderConfigurationProperties; - - // If the application provides AdminConfig customizers - // and overrides properties, those take precedence. - // adminClientConfigCustomizers.forEach(customizer -> customizer.configure(this.adminClientProperties)); } @Override diff --git a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/utils/RedisConnectionFactoryUtil.java b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/utils/RedisConnectionFactoryUtil.java index 8da255e..db2a226 100644 --- a/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/utils/RedisConnectionFactoryUtil.java +++ b/binders/spring-cloud-stream-binder-redis-core/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/utils/RedisConnectionFactoryUtil.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2023-2024, fubluesky (fubluesky@foxmail.com) + * + * Licensed 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 io.github.guoshiqiufeng.cloud.stream.binder.redis.utils; import lombok.experimental.UtilityClass; @@ -39,10 +54,9 @@ public RedisConnectionFactory getRedisConnectionFactory(RedisProperties redisPro private JedisConnectionFactory configureJedisClient(RedisProperties redisProperties) { - GenericObjectPoolConfig poolConfig = createPoolConfig(redisProperties); JedisClientConfiguration clientConfiguration = JedisClientConfiguration.builder() .usePooling() - .poolConfig(poolConfig) + .poolConfig(createPoolConfig(redisProperties)) .build(); return Optional.ofNullable(getSentinelConfig(redisProperties)) diff --git a/binders/spring-cloud-stream-binder-redis-core/src/test/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisBinderConfigurationPropertiesTest.java b/binders/spring-cloud-stream-binder-redis-core/src/test/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisBinderConfigurationPropertiesTest.java index 4e01a1d..2486901 100644 --- a/binders/spring-cloud-stream-binder-redis-core/src/test/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisBinderConfigurationPropertiesTest.java +++ b/binders/spring-cloud-stream-binder-redis-core/src/test/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/properties/RedisBinderConfigurationPropertiesTest.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2023-2024, fubluesky (fubluesky@foxmail.com) + * + * Licensed 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 io.github.guoshiqiufeng.cloud.stream.binder.redis.properties; /** diff --git a/binders/spring-cloud-stream-binder-redis/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/RedisMessageChannelBinder.java b/binders/spring-cloud-stream-binder-redis/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/RedisMessageChannelBinder.java index 44a772f..4a34a60 100644 --- a/binders/spring-cloud-stream-binder-redis/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/RedisMessageChannelBinder.java +++ b/binders/spring-cloud-stream-binder-redis/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/RedisMessageChannelBinder.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2023-2024, fubluesky (fubluesky@foxmail.com) + * + * Licensed 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 io.github.guoshiqiufeng.cloud.stream.binder.redis; import io.github.guoshiqiufeng.cloud.stream.binder.redis.properties.RedisBinderConfigurationProperties; diff --git a/binders/spring-cloud-stream-binder-redis/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/aot/RedisBinderRuntimeHints.java b/binders/spring-cloud-stream-binder-redis/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/aot/RedisBinderRuntimeHints.java index 3c3d685..331d114 100644 --- a/binders/spring-cloud-stream-binder-redis/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/aot/RedisBinderRuntimeHints.java +++ b/binders/spring-cloud-stream-binder-redis/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/aot/RedisBinderRuntimeHints.java @@ -1,28 +1,48 @@ -//package io.github.guoshiqiufeng.stream.binder.redis.aot; -// -//import io.github.guoshiqiufeng.stream.binder.redis.properties.RedisBindingProperties; -//import io.github.guoshiqiufeng.stream.binder.redis.properties.RedisConsumerProperties; -//import io.github.guoshiqiufeng.stream.binder.redis.properties.RedisExtendedBindingProperties; -//import io.github.guoshiqiufeng.stream.binder.redis.properties.RedisProducerProperties; -// -//import java.util.stream.Stream; -// -///** -// * @author yanghq -// * @version 1.0 -// * @since 2024/8/28 10:52 -// */ -//public class RedisBinderRuntimeHints implements RuntimeHintsRegistrar { -// -// @Override -// public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) { -// ReflectionHints reflectionHints = hints.reflection(); -// Stream.of( -// RedisConsumerProperties.class, -// RedisProducerProperties.class, -// RedisExtendedBindingProperties.class, -// RedisBindingProperties.class) -// .forEach(type -> reflectionHints.registerType(type, -// builder -> builder.withMembers(MemberCategory.INVOKE_DECLARED_METHODS))); -// } -//} +/* + * Copyright (c) 2023-2024, fubluesky (fubluesky@foxmail.com) + * + * Licensed 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 io.github.guoshiqiufeng.cloud.stream.binder.redis.aot; + +import io.github.guoshiqiufeng.cloud.stream.binder.redis.properties.RedisBindingProperties; +import io.github.guoshiqiufeng.cloud.stream.binder.redis.properties.RedisConsumerProperties; +import io.github.guoshiqiufeng.cloud.stream.binder.redis.properties.RedisExtendedBindingProperties; +import io.github.guoshiqiufeng.cloud.stream.binder.redis.properties.RedisProducerProperties; +import jakarta.annotation.Nullable; +import org.springframework.aot.hint.MemberCategory; +import org.springframework.aot.hint.ReflectionHints; +import org.springframework.aot.hint.RuntimeHints; +import org.springframework.aot.hint.RuntimeHintsRegistrar; + +import java.util.stream.Stream; + +/** + * @author yanghq + * @version 1.0 + * @since 2024/8/28 10:52 + */ +public class RedisBinderRuntimeHints implements RuntimeHintsRegistrar { + + @Override + public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) { + ReflectionHints reflectionHints = hints.reflection(); + Stream.of( + RedisConsumerProperties.class, + RedisProducerProperties.class, + RedisExtendedBindingProperties.class, + RedisBindingProperties.class) + .forEach(type -> reflectionHints.registerType(type, + builder -> builder.withMembers(MemberCategory.INVOKE_DECLARED_METHODS))); + } +} diff --git a/binders/spring-cloud-stream-binder-redis/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/config/ExtendedBindingHandlerMappingsProviderConfiguration.java b/binders/spring-cloud-stream-binder-redis/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/config/ExtendedBindingHandlerMappingsProviderConfiguration.java index 957b88c..1de80dd 100644 --- a/binders/spring-cloud-stream-binder-redis/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/config/ExtendedBindingHandlerMappingsProviderConfiguration.java +++ b/binders/spring-cloud-stream-binder-redis/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/config/ExtendedBindingHandlerMappingsProviderConfiguration.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2023-2024, fubluesky (fubluesky@foxmail.com) + * + * Licensed 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 io.github.guoshiqiufeng.cloud.stream.binder.redis.config; import org.springframework.boot.context.properties.source.ConfigurationPropertyName; diff --git a/binders/spring-cloud-stream-binder-redis/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/config/RedisBinderConfiguration.java b/binders/spring-cloud-stream-binder-redis/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/config/RedisBinderConfiguration.java index 278202f..7ede666 100644 --- a/binders/spring-cloud-stream-binder-redis/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/config/RedisBinderConfiguration.java +++ b/binders/spring-cloud-stream-binder-redis/src/main/java/io/github/guoshiqiufeng/cloud/stream/binder/redis/config/RedisBinderConfiguration.java @@ -1,3 +1,18 @@ +/* + * Copyright (c) 2023-2024, fubluesky (fubluesky@foxmail.com) + * + * Licensed 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 io.github.guoshiqiufeng.cloud.stream.binder.redis.config; import io.github.guoshiqiufeng.cloud.stream.binder.redis.RedisMessageChannelBinder; diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..72c76ac --- /dev/null +++ b/docs/README.md @@ -0,0 +1,27 @@ +--- +lang: zh-CN +home: true +title: 首页 +#heroImage: /images/logo.png +actions: + - text: 快速开始 + link: /guide/getting-started.html + type: primary + - text: 项目简介 + link: /guide/index.html + type: secondary +features: + - title: 统一规范 + details: 基于Spring Cloud Stream 规范开发 + - title: 快速集成 + details: 基于Spring Cloud 快速集成。 +footer: Apache License 2.0 | Copyright © 2023-present fubluesky +--- + +### 最新版本 +
+ +[![Maven central](https://img.shields.io/maven-central/v/io.github.guoshiqiufeng.cloud/spring-cloud-starter-stream-redis.svg?style=flat-square)](https://search.maven.org/search?q=g:io.github.guoshiqiufeng%20AND%20a:spring-cloud-starter-stream-redis) +[![GitHub release](https://img.shields.io/github/release/guoshiqiufeng/spring-cloud-stream-redis.svg)](https://github.com/guoshiqiufeng/spring-cloud-stream-redis) + +
diff --git a/docs/en/README.md b/docs/en/README.md new file mode 100644 index 0000000..5352076 --- /dev/null +++ b/docs/en/README.md @@ -0,0 +1,29 @@ +--- +lang: en-US +home: true +title: Home +#heroImage: /images/f.png +actions: + - text: Get Started + link: /en/guide/getting-started.html + type: primary + - text: Project Introduction + link: /guide/index.html + type: secondary +features: + - title: Standardize + details: Developed based on Spring Cloud Stream specification + - title: Rapid Integration + details: Fast integration based on Spring Cloud. +footer: Apache License 2.0 | Copyright © 2023-present fubluesky +--- + + +### Latest version + +
+ +[![Maven central](https://img.shields.io/maven-central/v/io.github.guoshiqiufeng.cloud/spring-cloud-starter-stream-redis.svg?style=flat-square)](https://search.maven.org/search?q=g:io.github.guoshiqiufeng%20AND%20a:spring-cloud-starter-stream-redis) +[![GitHub release](https://img.shields.io/github/release/guoshiqiufeng/spring-cloud-stream-redis.svg)](https://github.com/guoshiqiufeng/spring-cloud-stream-redis) + +
diff --git a/gradle.properties b/gradle.properties index a9c3337..feda146 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ # {x-release-please-start-version} -APP_VERSION=1.0.0-SNAPSHOT +APP_VERSION=0.1.0 # {x-release-please-end-version} APP_GROUP=io.github.guoshiqiufeng.cloud diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a441313..9355b41 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/settings.gradle b/settings.gradle index dc45bd0..9c7ca73 100644 --- a/settings.gradle +++ b/settings.gradle @@ -10,8 +10,8 @@ buildscript { //noinspection DifferentKotlinGradleVersion classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.21" classpath "gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.16.1" - classpath "io.freefair.gradle:lombok-plugin:8.4" - classpath "io.spring.gradle:dependency-management-plugin:1.1.3" + classpath "io.freefair.gradle:lombok-plugin:8.10" + classpath "io.spring.gradle:dependency-management-plugin:1.1.6" } }