spring-cloud-stream-samples | Samples for Spring Cloud Stream | Continuous Deployment library

 by   spring-cloud Java Version: Current License: Apache-2.0

kandi X-RAY | spring-cloud-stream-samples Summary

kandi X-RAY | spring-cloud-stream-samples Summary

spring-cloud-stream-samples is a Java library typically used in Devops, Continuous Deployment, Docker, Kafka applications. spring-cloud-stream-samples has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. However spring-cloud-stream-samples has 11 bugs. You can download it from GitHub.

This repository contains a collection of applications written using Spring Cloud Stream. All the applications are self contained. They can be run against either Kafka or RabbitMQ middleware technologies. You have the option of running the samples against local or Docker containerized versions of Kafka and Rabbit. For convenience, docker-compose.yml files are provided as part of each application wherever it is applicable. For this reason, Docker Compose is required and it’s recommended to use the latest version. These compose files bring up the middleware (kafka or Rabbit) and other necessary components for running each app. If you bring up Kafka or RabbitMQ in Docker containers, please make sure that you bring them down while in the same sample directory. You can read the README that is part of each sample and follow along the instructions to run them. You can build the entire samples by going to the root of the repository and then do: ./mvnw clean package However, the recommended approach to build them is to pick the sample that you are interested in and go to that particular app and follow the instructions there in the README for that app.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              spring-cloud-stream-samples has a medium active ecosystem.
              It has 854 star(s) with 646 fork(s). There are 82 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 33 open issues and 122 have been closed. On average issues are closed in 123 days. There are 5 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of spring-cloud-stream-samples is current.

            kandi-Quality Quality

              OutlinedDot
              spring-cloud-stream-samples has 11 bugs (1 blocker, 2 critical, 1 major, 7 minor) and 248 code smells.

            kandi-Security Security

              spring-cloud-stream-samples has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              spring-cloud-stream-samples code analysis shows 0 unresolved vulnerabilities.
              There are 19 security hotspots that need review.

            kandi-License License

              spring-cloud-stream-samples is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              spring-cloud-stream-samples releases are not available. You will need to build from source code and install.
              Build file is available. You can build the component from source.

            Top functions reviewed by kandi - BETA

            kandi has reviewed spring-cloud-stream-samples and discovered the below as its top functions. This is intended to give you an instant insight into spring-cloud-stream-samples implemented functionality, and help decide if they suit your requirements.
            • Downloads a file from a URL
            • Creates a thumbnail for the given URL .
            • Consumer consumer .
            • Create a function that invokes couchbase consumer .
            • Process an order request .
            • The source1 bean .
            • Factory method for timer messages .
            • Sends a sensor .
            • Handles a POST request .
            • Generate a random message .
            Get all kandi verified functions for this library.

            spring-cloud-stream-samples Key Features

            No Key Features are available at this moment for spring-cloud-stream-samples.

            spring-cloud-stream-samples Examples and Code Snippets

            No Code Snippets are available at this moment for spring-cloud-stream-samples.

            Community Discussions

            QUESTION

            Spring Cloud Stream functional approach: message conversion produces an object with empty field values
            Asked 2020-Dec-16 at 10:40

            I'm trying to create a reactive Spring Cloud Stream application with kafka following the functional approach (Spring Boot: 2.3.4, SC: Hoxton.SR9, SC Stream: 3.0.9, SC Function 3.0.11). Problem: Automatically deserialized object has empty field values.

            Json Payload of the kafka-message:

            ...

            ANSWER

            Answered 2020-Dec-15 at 11:07

            According to https://github.com/spring-cloud/spring-cloud-stream/issues/2056 this issue is related to 3.0.11-RELEASE of spring-cloud-function.

            Downgrading spring-cloud-function to 3.0.10-RELEASE solved the issue for now:

            Source https://stackoverflow.com/questions/65297525

            QUESTION

            Spring Cloud Stream (Hoxton) Kafka Producer / Consumer not working in integration tests with EmbeddedKafka
            Asked 2020-Feb-03 at 15:07

            I have a working application that uses the latest update for Producers that came with Hoxton. Now I'm trying to add some integration tests, asserting that the Producer is actually producing a message as expected. The problem is, the consumer I use in the test never reads anything from the topic.

            In order to make this issue reproducible I've resused a project (spring-cloud-stream-samples/source-samples/dynamic-destination-source-kafka) from the spring cloud stream samples, adapting it as follows:

            DynamicDestinationSourceApplication (The EmitterProcessor is now a bean)

            ...

            ANSWER

            Answered 2020-Feb-03 at 01:07

            I had testImplementation("org.springframework.cloud:spring-cloud-stream-test-support") incorrectly added as a dependency. This uses a Test Binder that is not meant to be used with integration tests.

            Source https://stackoverflow.com/questions/60030609

            QUESTION

            Spring cloud stream Confluent KStream Avro Consume
            Asked 2020-Feb-02 at 12:06

            I'm trying to consume confluent avro message from kafka topic as Kstream with spring boot 2.0.

            I was able to consume the message as MessageChannel but not as KStream.

            ...

            ANSWER

            Answered 2019-Nov-25 at 15:11

            Try spring.cloud.stream.kafka.streams.binder.configuration.schema.registry.url: ...

            Source https://stackoverflow.com/questions/59031141

            QUESTION

            Spring Boot Kafka Streams - Binding Issue
            Asked 2020-Jan-25 at 11:43

            I am trying build out a simple streams app based on Kafka Streams using this example.

            Word Count

            However when I am starting the app, I get the below error: Can someone please point out on what I am missing out here? Here is the code, config & error

            ...

            ANSWER

            Answered 2018-Jun-05 at 07:05

            Try moving EnableBinding annotation to DemoApplication class. I believe it should be put on @Configuration class, not on arbitrary @Component.

            Source https://stackoverflow.com/questions/50693858

            QUESTION

            Using embedded Kafka in spring cloud stream test with custom channel bindings
            Asked 2019-Oct-12 at 13:24

            I have a spring boot application where I am using spring-cloud-stream to consume from a kafka topic, do some processing and publish to another kafka topic. The application works fine and I've written unit tests (using the TestBinder) which are running fine as well.

            I am now trying to write an integration test with an embedded Kafka and test the end-to-end functionality. I have followed the sample here https://github.com/spring-cloud/spring-cloud-stream-samples/blob/master/testing-samples/test-embedded-kafka/src/test/java/demo/EmbeddedKafkaApplicationTests.java to write the test however this is not working - I am unable to receive any message on the output topic.

            application.yml

            ...

            ANSWER

            Answered 2019-Oct-12 at 13:24

            ConsumerRecords records = consumer.poll(0);

            You need wait for the subscription to occur; 0 won't do it; the sample waits for up to 10 seconds.

            However, it's safer to use

            embeddedKafkaRule().getEmbeddedKafka().consumeFromAnEmbeddedTopic(...);

            because it reliably waits for assignment using a ConsumerRebalanceListener.

            Once subscribed, you can also use

            Source https://stackoverflow.com/questions/58351459

            QUESTION

            Why can I see only every other message in this Kafka example?
            Asked 2019-Aug-12 at 13:43

            I'm trying to modify one of spring cloud stream samples and the results I'm getting are confusing - even though I registered only a single stream listener for my channel I'm getting only every second message. I suspect this is caused by default load balancing for a single kafka partition, but I can't figure out how to confirm this.

            docker ps shows only a single instance of kafka broker being up

            ...

            ANSWER

            Answered 2019-Aug-12 at 13:43

            You have two consumers on the output channel - the binding to the topic and your receive() service activator.

            The default round robin processing sends messages alternately to your service activator and the topic.

            Source https://stackoverflow.com/questions/57443978

            QUESTION

            How to use interactive query within kafka process topology in spring-cloud-stream?
            Asked 2019-May-01 at 14:16

            Is it possible to use interactive query (InteractiveQueryService) within Spring Cloud Stream the class with @EnableBinding annotation or within the method with @StreamListener? I tried instantiating ReadOnlyKeyValueStore within provided KStreamMusicSampleApplication class and process method but its always null.

            My @StreamListener method is listening to a bunch of KTables and KStreams and during the process topology e.g filtering, I have to check whether the key from a KStream already exists in a particular KTable.

            I tried to figure out how to scan an incoming KTable to check if a key already exists but no luck. Then I came across InteractiveQueryService whose get() method could be used to check if a key exists inside a state store materializedAs from a KTable. The problem is that I can't access it from with the process topology (@EnableBinding or @StreamListener). It can only be accessed from outside these annotation e.g RestController.

            Is there a way to scan an incoming KTable to check for the existence of a key or value? if not then can we access InteractiveQueryService within the process topology?

            ...

            ANSWER

            Answered 2019-May-01 at 14:16

            InteractiveQueryService in Spring Cloud Stream is not available to be used within the actual topology in your StreamListener. As you mentioned, it is supposed to be used outside of your main topology. However, with the use case you described, you still can use the state store from your main flow. For example, if you have an incoming KStream and a KTable which is materialized as a state store, then you can call process on the KStream and access the state store that way. Here is a rough code to achieve that. You need to convert this to fit into your specific use case, but here is the idea.

            Source https://stackoverflow.com/questions/55931237

            QUESTION

            How does Spring Kafka/Spring Cloud Stream guarantee the transactionality / atomicity involving a Database and Kafka?
            Asked 2019-Apr-26 at 14:11

            Spring Kafka, and thus Spring Cloud Stream, allow us to create transactional Producers and Processors. We can see that functionality in action in one of the sample projects: https://github.com/spring-cloud/spring-cloud-stream-samples/tree/master/transaction-kafka-samples:

            ...

            ANSWER

            Answered 2019-Apr-26 at 14:11

            There is no guarantee, only within Kafka itself.

            Spring provides transaction synchronization so the the commits are close together but it is possible for the DB to commit and the Kafka does not. So you have to deal with the possibility of duplicates.

            The correct way to do this, when using spring-kafka directly, is NOT with @Transactional but to use a ChainedKafkaTransactionManager in the listener container.

            See Transaction Synchronization.

            Also see Distributed transactions in Spring, with and without XA and the "Best Efforts 1PC pattern" for background.

            However, with Stream, there is no support for the chained transaction manager, so the @Transactional is required (with the DB transaction manager). This will provide similar results to chained tx manager, with the DB committing first, just before Kafka.

            Source https://stackoverflow.com/questions/55868528

            QUESTION

            Spring Cloud Stream - Integration testing
            Asked 2019-Apr-18 at 10:53

            I have micro services built based on Spring Cloud Stream. Testing team needs to create integration test for these services. What are best practices?

            Based on the sample below, Sink/Source/Processor from different applications needs to be in classpath of the testing project. Is the expectation is to package each service and include it in testing project?

            https://github.com/spring-cloud/spring-cloud-stream-samples/blob/master/testing-samples/testing-demo/src/test/java/org/springframework/cloud/stream/testing/processor/integration/ToUpperCaseProcessorIntTests.java

            Thanks

            ...

            ANSWER

            Answered 2019-Apr-18 at 10:53

            When it comes to "integration" testing of spring-cloud-stream the scope starts/stops within a single stream. What you are asking about is testing a flow where several streams are connected via remote queues/topics etc. That is out of scope of spring-cloud-stream testing.

            However, there is another framework which is specifically designed to create, manage, monitor, control etc., as well as test these flows. I am talking about Spring Cloud Data Flow where with a simple set of commands and/or using GUI you can assemble your stream apps into a flow.

            Source https://stackoverflow.com/questions/55739806

            QUESTION

            Error: Multiple destinations cannot be specified
            Asked 2018-Nov-14 at 17:55

            I am trying to configure sending out message to two out put streams like following.

            ...

            ANSWER

            Answered 2018-Nov-14 at 17:55

            It is not possible to send to multiple destinations as you describe from a StreamListener method when using regular MessageChannel based binders. It is possible to send to multiple topics using the Kafka Streams binder's branching feature which you are referring to in the link provided above. If you want to send to multiple destinations in your application, one option is to use the dynamic destination feature of Spring Cloud Stream. Here is an example of how dynamic destinations work.

            Source https://stackoverflow.com/questions/53293249

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install spring-cloud-stream-samples

            You can download it from GitHub.
            You can use spring-cloud-stream-samples like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the spring-cloud-stream-samples component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/spring-cloud/spring-cloud-stream-samples.git

          • CLI

            gh repo clone spring-cloud/spring-cloud-stream-samples

          • sshUrl

            git@github.com:spring-cloud/spring-cloud-stream-samples.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link