저는 Spring Boot 버전 2.4.2를 사용하고 있으며 @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);
}
}
대안은 무엇일까요? 위 코드를 리팩토링하는 방법은 무엇입니까? 무슨 일이 일어나고 무슨 일이 일어나고 있는지 이해하기 어려워지는 속도로 많은 일들이 일어나고 있습니까?