diff --git a/.github/actions/for-module-in-group/action.yaml b/.github/actions/for-module-in-group/action.yaml index c0bf4e727..5103468da 100644 --- a/.github/actions/for-module-in-group/action.yaml +++ b/.github/actions/for-module-in-group/action.yaml @@ -69,15 +69,4 @@ runs: OSSRH_USER: ${{ inputs.OSSRH_USER }} OSSRH_PASSWORD: ${{ inputs.OSSRH_PASSWORD }} SIGNING_KEY: ${{ inputs.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ inputs.SIGNING_PASSWORD }} - - - name: "Gradle Build & Publish | kafka-client: responsive-spring" - if: ${{ (inputs.module == 'kafka-client') && (inputs.action == 'gradle-build-and-publish') }} - uses: ./.github/actions/gradle-build-and-publish - with: - module: "responsive-spring" - force_version: ${{ steps.gradle-build-and-publish-root-module.outputs.release_version }} - OSSRH_USER: ${{ inputs.OSSRH_USER }} - OSSRH_PASSWORD: ${{ inputs.OSSRH_PASSWORD }} - SIGNING_KEY: ${{ inputs.SIGNING_KEY }} - SIGNING_PASSWORD: ${{ inputs.SIGNING_PASSWORD }} + SIGNING_PASSWORD: ${{ inputs.SIGNING_PASSWORD }} \ No newline at end of file diff --git a/responsive-spring/build.gradle.kts b/responsive-spring/build.gradle.kts deleted file mode 100644 index 71a1e0f87..000000000 --- a/responsive-spring/build.gradle.kts +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2024 Responsive Computing, Inc. - * - * This source code is licensed under the Responsive Business Source License Agreement v1.0 - * available at: - * - * https://www.responsive.dev/legal/responsive-bsl-10 - * - * This software requires a valid Commercial License Key for production use. Trial and commercial - * licenses can be obtained at https://www.responsive.dev - */ - -import java.io.ByteArrayOutputStream - -/* - * Copyright 2023 Responsive Computing, Inc. - * - * 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. - */ - -plugins { - id("responsive.java-library-conventions") - id("java") -} - -java { - toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) - } -} - -version = project(":kafka-client").version - -dependencies { - implementation(project(":kafka-client")) - implementation("com.google.code.findbugs:jsr305:3.0.2") - implementation("org.springframework.kafka:spring-kafka:3.3.0") - implementation("org.springframework.boot:spring-boot-starter:3.3.2") - - testImplementation(testlibs.bundles.base) -} \ No newline at end of file diff --git a/responsive-spring/src/main/java/dev/responsive/spring/annotations/EnableResponsive.java b/responsive-spring/src/main/java/dev/responsive/spring/annotations/EnableResponsive.java deleted file mode 100644 index b0506055a..000000000 --- a/responsive-spring/src/main/java/dev/responsive/spring/annotations/EnableResponsive.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2024 Responsive Computing, Inc. - * - * This source code is licensed under the Responsive Business Source License Agreement v1.0 - * available at: - * - * https://www.responsive.dev/legal/responsive-bsl-10 - * - * This software requires a valid Commercial License Key for production use. Trial and commercial - * licenses can be obtained at https://www.responsive.dev - */ - -package dev.responsive.spring.annotations; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import org.springframework.context.annotation.Import; - -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -@Documented -@Import(ResponsiveDefaultConfiguration.class) -public @interface EnableResponsive { -} diff --git a/responsive-spring/src/main/java/dev/responsive/spring/annotations/ResponsiveDefaultConfiguration.java b/responsive-spring/src/main/java/dev/responsive/spring/annotations/ResponsiveDefaultConfiguration.java deleted file mode 100644 index 45efaa564..000000000 --- a/responsive-spring/src/main/java/dev/responsive/spring/annotations/ResponsiveDefaultConfiguration.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2024 Responsive Computing, Inc. - * - * This source code is licensed under the Responsive Business Source License Agreement v1.0 - * available at: - * - * https://www.responsive.dev/legal/responsive-bsl-10 - * - * This software requires a valid Commercial License Key for production use. Trial and commercial - * licenses can be obtained at https://www.responsive.dev - */ - -package dev.responsive.spring.annotations; - -import dev.responsive.spring.config.ResponsiveKafkaStreamsCustomizer; -import org.springframework.beans.factory.ObjectProvider; -import org.springframework.beans.factory.UnsatisfiedDependencyException; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.kafka.annotation.KafkaStreamsDefaultConfiguration; -import org.springframework.kafka.config.KafkaStreamsConfiguration; -import org.springframework.kafka.config.StreamsBuilderFactoryBean; -import org.springframework.kafka.config.StreamsBuilderFactoryBeanConfigurer; - -@Configuration(proxyBeanMethods = false) -public class ResponsiveDefaultConfiguration extends KafkaStreamsDefaultConfiguration { - - @Bean(name = DEFAULT_STREAMS_BUILDER_BEAN_NAME) - @Override - public StreamsBuilderFactoryBean defaultKafkaStreamsBuilder( - @Qualifier(DEFAULT_STREAMS_CONFIG_BEAN_NAME) - final ObjectProvider streamsConfigProvider, - final ObjectProvider configurerProvider - ) { - KafkaStreamsConfiguration streamsConfig = streamsConfigProvider.getIfAvailable(); - if (streamsConfig != null) { - StreamsBuilderFactoryBean fb = new StreamsBuilderFactoryBean(streamsConfig); - configurerProvider.orderedStream().forEach(configurer -> configurer.configure(fb)); - fb.setKafkaStreamsCustomizer((ResponsiveKafkaStreamsCustomizer) kafkaStreams -> { }); - return fb; - } else { - throw new UnsatisfiedDependencyException(KafkaStreamsDefaultConfiguration.class.getName(), - DEFAULT_STREAMS_BUILDER_BEAN_NAME, "streamsConfig", "There is no '" - + DEFAULT_STREAMS_CONFIG_BEAN_NAME + "' " + KafkaStreamsConfiguration.class.getName() - + " bean in the application context.\n" - + "Consider declaring one or don't use @EnableKafkaStreams." - ); - } - } -} diff --git a/responsive-spring/src/main/java/dev/responsive/spring/config/ResponsiveKafkaStreamsCustomizer.java b/responsive-spring/src/main/java/dev/responsive/spring/config/ResponsiveKafkaStreamsCustomizer.java deleted file mode 100644 index feb3dd0ca..000000000 --- a/responsive-spring/src/main/java/dev/responsive/spring/config/ResponsiveKafkaStreamsCustomizer.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2024 Responsive Computing, Inc. - * - * This source code is licensed under the Responsive Business Source License Agreement v1.0 - * available at: - * - * https://www.responsive.dev/legal/responsive-bsl-10 - * - * This software requires a valid Commercial License Key for production use. Trial and commercial - * licenses can be obtained at https://www.responsive.dev - */ - -package dev.responsive.spring.config; - -import dev.responsive.kafka.api.ResponsiveKafkaStreams; -import java.util.Properties; -import org.apache.kafka.streams.KafkaClientSupplier; -import org.apache.kafka.streams.KafkaStreams; -import org.apache.kafka.streams.Topology; -import org.springframework.kafka.config.KafkaStreamsCustomizer; - -public interface ResponsiveKafkaStreamsCustomizer extends KafkaStreamsCustomizer { - @Override - default KafkaStreams initKafkaStreams( - Topology topology, - Properties properties, - KafkaClientSupplier clientSupplier - ) { - return new ResponsiveKafkaStreams(topology, properties, clientSupplier); - } -} diff --git a/responsive-spring/src/test/java/dev/responsive/spring/KafkaStreamsApp.java b/responsive-spring/src/test/java/dev/responsive/spring/KafkaStreamsApp.java deleted file mode 100644 index c4d37aad3..000000000 --- a/responsive-spring/src/test/java/dev/responsive/spring/KafkaStreamsApp.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright 2024 Responsive Computing, Inc. - * - * This source code is licensed under the Responsive Business Source License Agreement v1.0 - * available at: - * - * https://www.responsive.dev/legal/responsive-bsl-10 - * - * This software requires a valid Commercial License Key for production use. Trial and commercial - * licenses can be obtained at https://www.responsive.dev - */ - -package dev.responsive.spring; - -import dev.responsive.kafka.api.config.ResponsiveConfig; -import dev.responsive.kafka.api.config.StorageBackend; -import dev.responsive.spring.annotations.EnableResponsive; -import java.time.Duration; -import java.util.HashMap; -import java.util.Map; -import org.apache.kafka.clients.admin.AdminClientConfig; -import org.apache.kafka.clients.admin.NewTopic; -import org.apache.kafka.clients.producer.ProducerConfig; -import org.apache.kafka.common.TopicPartition; -import org.apache.kafka.common.serialization.ByteArraySerializer; -import org.apache.kafka.common.serialization.Serdes; -import org.apache.kafka.streams.KeyValue; -import org.apache.kafka.streams.StreamsBuilder; -import org.apache.kafka.streams.StreamsConfig; -import org.apache.kafka.streams.kstream.KStream; -import org.apache.kafka.streams.kstream.Named; -import org.apache.kafka.streams.kstream.Printed; -import org.apache.kafka.streams.kstream.TimeWindows; -import org.apache.kafka.streams.kstream.ValueMapper; -import org.junit.jupiter.api.Disabled; -import org.springframework.boot.SpringApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.kafka.annotation.EnableKafka; -import org.springframework.kafka.annotation.KafkaStreamsDefaultConfiguration; -import org.springframework.kafka.config.KafkaStreamsConfiguration; -import org.springframework.kafka.config.StreamsBuilderFactoryBeanConfigurer; -import org.springframework.kafka.config.TopicBuilder; -import org.springframework.kafka.core.DefaultKafkaProducerFactory; -import org.springframework.kafka.core.KafkaAdmin; -import org.springframework.kafka.core.KafkaTemplate; -import org.springframework.kafka.core.ProducerFactory; -import org.springframework.kafka.listener.DeadLetterPublishingRecoverer; -import org.springframework.kafka.streams.RecoveringDeserializationExceptionHandler; - -@Configuration -@EnableKafka -@EnableResponsive -@Disabled // ignore from tests -public class KafkaStreamsApp { - - public static void main(String[] args) throws NoSuchMethodException { - SpringApplication.run(KafkaStreamsApp.class, args); - } - - @Bean(name = KafkaStreamsDefaultConfiguration.DEFAULT_STREAMS_CONFIG_BEAN_NAME) - public KafkaStreamsConfiguration streamsConfigs() { - Map props = new HashMap<>(); - props.put(StreamsConfig.APPLICATION_ID_CONFIG, "testStreams"); - props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092"); - props.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass().getName()); - props.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass().getName()); - props.put(ResponsiveConfig.STORAGE_BACKEND_TYPE_CONFIG, StorageBackend.MONGO_DB.name()); - props.put(ResponsiveConfig.MONGO_ENDPOINT_CONFIG, "mongodb://localhost:27017"); - props.put(StreamsConfig.DEFAULT_DESERIALIZATION_EXCEPTION_HANDLER_CLASS_CONFIG, - RecoveringDeserializationExceptionHandler.class); - props.put( - RecoveringDeserializationExceptionHandler.KSTREAM_DESERIALIZATION_RECOVERER, - recoverer() - ); - return new KafkaStreamsConfiguration(props); - } - - @Bean - public StreamsBuilderFactoryBeanConfigurer moreMagic() { - return fb -> fb.setStateListener((newState, oldState) -> { - System.out.println("State transition from " + oldState + " to " + newState); - }); - } - - @Bean - public KafkaAdmin admin() { - Map configs = new HashMap<>(); - configs.put(AdminClientConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092"); - return new KafkaAdmin(configs); - } - - @Bean - public NewTopic topic1() { - return TopicBuilder.name("streamingTopic1") - .build(); - } - - @Bean - public KStream magic(StreamsBuilder streamBuilder, KafkaAdmin admin) { - KStream stream = streamBuilder.stream("streamingTopic1"); - stream - .mapValues((ValueMapper) String::toUpperCase) - .groupByKey() - .windowedBy(TimeWindows.ofSizeWithNoGrace(Duration.ofMillis(1_000))) - .reduce((String value1, String value2) -> value1 + value2, - Named.as("windowStore")) - .toStream() - .map((windowedId, value) -> new KeyValue<>(windowedId.key(), value)) - .filter((i, s) -> s.length() > 40) - .to("streamingTopic2"); - - stream.print(Printed.toSysOut()); - return stream; - } - - @Bean - public DeadLetterPublishingRecoverer recoverer() { - return new DeadLetterPublishingRecoverer(kafkaTemplate(), - (record, ex) -> new TopicPartition("recovererDLQ", -1)); - } - - @Bean - public ProducerFactory producerFactory() { - Map configProps = new HashMap<>(); - configProps.put( - ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, - "localhost:9092"); - configProps.put( - ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, - ByteArraySerializer.class); - configProps.put( - ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, - ByteArraySerializer.class); - return new DefaultKafkaProducerFactory<>(configProps); - } - - @Bean - public KafkaTemplate kafkaTemplate() { - return new KafkaTemplate<>(producerFactory()); - } - -} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 2817ed152..757969139 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -22,7 +22,6 @@ include("kafka-client-examples:simple-example") include("kafka-client-examples:e2e-test") include("kafka-client-bootstrap") include("responsive-test-utils") -include("responsive-spring") include("controller-api") include("operator")