I am using Spring Boot version 2.4.2 and doing Spring Cloud Stream and Spring Integration using @InboundChannelAdapter .
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.integration.annotation.InboundChannelAdapter;
@EnableBinding(value = Source.class)
public class TransactionPublisher {
@InboundChannelAdapter(channel = Source.OUTPUT)
public String sendTransactionDetails() {
return "{name:\"T1\", amount: \"1000\", transactionFor : \"Purchase\"}";
}
}
RabbitmqReceiverApplication.java
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
@EnableBinding(value = Sink.class)
@SpringBootApplication
public class RabbitmqReceiverApplication {
public static void main(String[] args) {
SpringApplication.run(RabbitmqReceiverApplication.class, args);
}
@StreamListener(Sink.INPUT)
public void log(String message) {
System.out.println(message);
}
}
What could be the alternative ? how to refactor the above code then? A lot of things are happening with the pace getting difficult to understand whats coming and whats going off ?