ItemReader is reading data from DB2 and gave java object ClaimDto. Now the ClaimProcessor takes in the object of ClaimDto and return CompositeClaimRecord object which comprises of claimRecord1 and claimRecord2 which to be sent to two different Kafka topics. How to write claimRecord1 and claimRecord2 to topic1 and topic2 respectively.
Spring Batch : One Reader, composite processor (two classes with different entities) and two kafkaItemWriter
1.1k Views Asked by Sonia At
2
There are 2 best solutions below
3
Mahmoud Ben Hassine
On
You can use a ClassifierCompositeItemWriter with two KafkaItemWriters as delegates (one for each topic).
The Classifier would classify items according to their type (claimRecord1 or claimRecord2) and route them to the corresponding kafka item writer (topic1 or topic2).
Related Questions in SPRING-BOOT
- Timing Issue with Spring Boot Annotation Configuration
- LightAdmin - Customise parsing DateTime with app timezone
- Creating distribution with repackaged spring boot jar using gradle application plugin
- Spring Boot MVC non-role based security
- Add JVM args to spring boot application
- The method and() is undefined for the type HttpSecurity
- swagger ui not working for swagger version 2
- Spring IO Platform 2.0 - Themes/Changes?
- JPA findDistinctPropertyBy magic method doesn't work as expected when using spring-boot-starter-jpa
- Spring boot check external service status on boot
- Running a specific spring batch job amongst several jobs contained withing a spring boot fat jar
- Adding security to rest api service built with Spring Boot app
- Spring Redirecting from Http to Https Breaks Rest Controller Test
- Service not starting using Spring-boot during integration tests
- Spring Boot Actuator Health Returning DOWN
Related Questions in APACHE-KAFKA
- Spark streaming + kafka throughput
- How to diagnose Kafka topics failing globally to be found
- kafka: what do 'soTimeout', 'bufferSize' and 'minBytes' mean for SimpleConsumer?
- Fail to create SparkContext
- Syntax error on tokens, delete these tokens - kafka spring integration demo application
- How could Kafka 0.8.2.1 with offsets.storage=kafka still require ZooKeeper?
- Message Queues: Per Message Guarantees
- How should a Kafka HLC figure out the # of partitions for a topic?
- Kafka multiple consumers for a partition
- Should Apache Kafka and Hadoop be installed seperatedly (on a diffrent cluster)?
- how does one combine kafka-node producer and node tail?
- How to fix NoClassDefFoundError with custom Kafka producer under Eclipse?
- Apache Samza's CheckpointTool won't give away partition offsets
- Offsets for Kafka Direct Approach in Spark 1.3.1
- Simulate kafka broker failures in multi node kafka cluster and what operations and tools to use to mitigate data loss issues
Related Questions in SPRING-BATCH
- Running a specific spring batch job amongst several jobs contained withing a spring boot fat jar
- Spring Batch | Read Count = Filter + Write?
- How to call a stored procedure from a Spring Batch Tasklet?
- how to implement complex pattern matching in Spring batch using PatternMatchingCompositeLineMapper
- More than one tasklet in a step?
- Execute database operations inside a chunck orientad step
- Load additional property file in spring batch admin
- Apache POI serialization issue in spring batch
- Spring batch difference between Multithreading vs partitioning
- spring batch Running only one Job Instance at a time and create queue it up
- How to call a specific method of a tasklet
- Spring batch job execution context and step execution context clarification needed
- Remote chunking with Spring Batch job distribution
- How to integrate spring-xd batch jobs with Control-M scheduler
- How to set property using "tasklet ref" tag
Related Questions in KAFKA-PRODUCER-API
- kafka partition and producer relationship
- Kafka producer issue: UnknownTopicOrPartitionException
- Not able to convert the byte[] to string in scala
- Logstash kafka input plugin unable to read any messages with new consumer and by setting auto_offset_reset to earliest
- What metrics to use for Kafka failures in request handling?
- Kafka producer unable to send data to server
- kafka Client Api questions
- Kafka producers/brokers not using specified IP
- publishing message to external Kafka Broker from docker container
- Kafka Android issue
- Kafka command line producer/consumer have 1 second latency
- How to send kafka matching data to other topic
- Kafka Producer stops +/- randomly and does not accept modified Properties
- What's the best way to design message key in Kafka?
- Matching Kafka consumer and producer partition
Related Questions in ITEMWRITER
- Spring Batch: How can i set record separator policy in FlatFileItemWriter?
- Can I use FlatFileItemWriter to write multi-format file in Spring Batch?
- Spring Batch : One Reader, composite processor (two classes with different entities) and two kafkaItemWriter
- How to use Classifier with ClassifierCompositeItemWriter?
- Spring batch itemwriter interface
- FlatFileItemWriter not generating the file when using Tasklet approach
- Spring Batch + MongoItemReader, ItemProcessor, MongoItemWriter + not reading all records
- Spring Batch jdbcbatchitemwriter afterpropertiesset repeat trigger twice
- Can we use Spring batch Item Reader and Writer on a file which needs to skip first and last line?
- FlatfileItemWriter with Compositewriter example
- Write the same data with different file names using single Item writer using Spring Batch
- To separate steps class in spring batch
- Spring-Batch: Item writer for Parent-Child relationship
- Spring Batch : Write a List to a database table using a custom batch size
- How does the JdbcBatchItemWriter decide the batch size?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Just write a custom
ItemWriterthat does exactly that.Or instead of writing 1 record at a time convert the single list into 2 lists and pass that along. But error handling might be a bit of a challenge that way. \