-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue with messages not being sent to MQTT and LogFile channels…
…; Channel beans type changed to MessageChannel (additional cast to specific channels is now needed if required)
- Loading branch information
1 parent
71a9485
commit eedae59
Showing
5 changed files
with
92 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 18 additions & 7 deletions
25
src/main/java/dev/markodojkic/softwaredevelopmentsimulation/flow/PrintoutFlow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,46 @@ | ||
package dev.markodojkic.softwaredevelopmentsimulation.flow; | ||
|
||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.integration.dsl.IntegrationFlow; | ||
import org.springframework.integration.handler.LoggingHandler; | ||
import org.springframework.messaging.MessageChannel; | ||
|
||
@Configuration | ||
public class PrintoutFlow { | ||
private static final String PRINTER_TRANSFORMER_BEAN = "printerTransformer"; | ||
|
||
@Bean | ||
public IntegrationFlow informationPrintoutFlow(){ | ||
public IntegrationFlow informationPrintoutFlow(@Qualifier("information.mqtt.input") MessageChannel mqttMessageChannel, @Qualifier("information.logFile.input") MessageChannel logFileMessageChannel) { | ||
return IntegrationFlow.from("information.input") | ||
.transform(PRINTER_TRANSFORMER_BEAN, "infoOutput") | ||
.log(LoggingHandler.Level.INFO, message -> System.lineSeparator().concat(message.getPayload().toString())) | ||
.channel("information.mqtt.input").channel("information.logFile.input").get(); | ||
.handle(message -> { | ||
mqttMessageChannel.send(message); | ||
logFileMessageChannel.send(message); | ||
}).get(); | ||
} | ||
|
||
@Bean | ||
public IntegrationFlow jiraActivityStreamPrintoutFlow(){ | ||
public IntegrationFlow jiraActivityStreamPrintoutFlow(@Qualifier("jiraActivityStream.mqtt.input") MessageChannel mqttMessageChannel, @Qualifier("jiraActivityStream.logFile.input") MessageChannel logFileMessageChannel) { | ||
return IntegrationFlow.from("jiraActivityStream.input") | ||
.transform(PRINTER_TRANSFORMER_BEAN, "jiraActivityStreamOutput") | ||
.log(LoggingHandler.Level.INFO, message -> System.lineSeparator().concat(message.getPayload().toString())) | ||
.channel("jiraActivityStream.mqtt.input").channel("jiraActivityStream.logFile.input").get(); | ||
.handle(message -> { | ||
mqttMessageChannel.send(message); | ||
logFileMessageChannel.send(message); | ||
}).get(); | ||
} | ||
|
||
@Bean | ||
public IntegrationFlow errorPrintoutFlow(){ | ||
public IntegrationFlow errorPrintoutFlow(@Qualifier("errorChannel.mqtt.input") MessageChannel mqttMessageChannel, @Qualifier("errorChannel.logFile.input") MessageChannel logFileMessageChannel) { | ||
return IntegrationFlow.from("errorChannel") | ||
.transform(PRINTER_TRANSFORMER_BEAN, "errorOutput") | ||
.log(LoggingHandler.Level.ERROR, message -> System.lineSeparator().concat(message.getPayload().toString())) | ||
.channel("error.mqtt.input").channel("error.logFile.input").get(); | ||
.handle(message -> { | ||
mqttMessageChannel.send(message); | ||
logFileMessageChannel.send(message); | ||
}).get(); | ||
} | ||
} | ||
} |
Oops, something went wrong.