Search code examples
springspring-cloudspring-cloud-stream

Receive Payload from IBM MQ spring boot listner then send data to rabbit mq in functional approch


//take message from ibm mq    
@JmsListener(destination = "${ibm.mq.ackqueue}", concurrency="${ibm.mq.concurrency}")
public void receive(Message message){//get playload}

@Bean
public Function<Response, EventDto> transformEvent() {
//take response from ibm mq
//then process and send eventdto to rabbit mq from spring cloud stream approach
}

this two methods are need functional approach.


Solution

  • Since you're receiving message from arbitrary resource (JMS in this case) and you want to use s-c-stream to send such message to RabbitMQ, you can use a component that is specifically designed for that case - StreamBridge

    Simply autowire it and use it inside of the receive method to send a Message to Rabbit (providing rabbit binder is on the classpath)

    You don't need

    @Bean
    public Function<Response, EventDto> transformEvent() {
    //take response from ibm mq
    //then process and send eventdto to rabbit mq from spring cloud stream approach
    }
    

    You can find more information here