I have an Akka stream source from a Message queue, for example RabbitMq. For each message I want to execute an http request, map the http request to an object and proceed downward.
Is this possible by using a flow from the akka http (Http().outgoingConnection) or should the request be executed inside a map operation?
This is exactly what Http().outgoingConnection
is used for (as mentioned in the question):
type MQMessage = ???
val messageToRequest : (MQMessage) => HttpRequest = ???
type ObjectType = ???
val responseToObjectType = (HttpResponse) => ObjectType = ???
val httpHost : String = ???
val messageFlow : Flow[MQMessage, ObjectType, _] =
Flow.map(messageToRequest)
.via(Http().outgoingConnection(httpHost))
.map(responseToObjectType)