Thank you so much, very good solution!
On Monday, July 27, 2015 at 11:12:50 AM UTC-3, √ wrote:
>
> maxSpeedsSource = Source.actorPublisher + expand
> carStatusSource = some source of CarStatus
> isSpeedingFlow = Flow[(CarStatus, Double)].map { case (status, speed) =>
> status.speed > speed }
>
> So your logic becomes something like: carStatusSouce zip maxSpeedsSource
> via isSpeedingFlow
>
> On Mon, Jul 27, 2015 at 4:02 PM, <[email protected] <javascript:>>
> wrote:
>
>> ActorPublish is a Source, my problem is in a Flow stage. But I can
>> understanding wrong
>> On Monday, July 27, 2015 at 10:59:14 AM UTC-3, √ wrote:
>>>
>>> Unfortunately, it is not only strange, it is also broken (global state +
>>> unmanaged concurrent access).
>>> What was wrong with my suggestions?
>>>
>>> On Mon, Jul 27, 2015 at 3:49 PM, <[email protected]> wrote:
>>>
>>>> This solve my problem, but seems strange:
>>>>
>>>> object SpeedViolation {
>>>> var state: Option[Double] = None
>>>>
>>>> def apply(maxSpeed: Double) = {
>>>> state = Some(maxSpeed)
>>>> Flow[(CarStatus, Option[Double])].map((params) => {
>>>> val (carStatus, speed) = params
>>>> state = speed orElse state
>>>> carStatus.speed > state.get
>>>> })
>>>> }
>>>> }
>>>>
>>>>
>>>> The flow input is a tuple, the element I want process and a Option
>>>> parameter. What do you think?
>>>>
>>>> On Monday, July 27, 2015 at 9:24:34 AM UTC-3, Matheus Lima wrote:
>>>>
>>>>> How can I create a dynamic flow? I'm developing a stream processing
>>>>> application and I have a specific stage that I need perform a calculation
>>>>> over input considering a parameter. And I need change this parameter
>>>>> dynamically. For example:
>>>>> case class CarStatus(position: Position, speed: Double)
>>>>> Flow[CarStatus].map(_.speed > 80)
>>>>> How can I transform 80 in a dynamic parameter?
>>>>> Thank you.
>>>>>
>>>> --
>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>> >>>>>>>>>> Check the FAQ:
>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>> >>>>>>>>>> Search the archives:
>>>> https://groups.google.com/group/akka-user
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Akka User List" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>>
>>> --
>>> Cheers,
>>> √
>>>
>>
>
>
> --
> Cheers,
> √
>
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.