Hi Roland,

In the end I solved it used various type classes from Scalaz and created a 
"Flowz" class to remove the boiler plat from using it with "Flow" DSL. Then 
included the beanstalk deleter as the sink at the end of all possible 
routes in my graph.

See the Flowz implementation here: 
https://gist.github.com/DomBlack/568752041e4ec0cecc18

Cheers,

Dom

On Friday, 14 August 2015 11:13:04 UTC+1, Akka Team wrote:
>
> Hi Dom,
>
> this keeps coming up in different forms and the use-case is a valid one. 
> So far I’d say that it is possible to write F1 and F2 generically such that 
> they carry some auxiliary information of type T around and that may or may 
> not be used; when applied in the beanstalk context this would be a job ID, 
> during tests it could be some debug info that helps identify what went 
> wrong (in case something ever does). The problem with trying to lift this 
> into the framework is that we have stages/junctions that are non-obvious to 
> deal with (essentially everything that is not 1:1 element-wise).
>
> As an example you can take a look at the HTTP client which provides such 
> generic flows, threading some T through from request to response.
>
> Would this be adequate in your situation? If not, do you have a brilliant 
> idea of what would be?
>
> Regards,
>
> Roland
>
> On Thu, May 28, 2015 at 5:19 PM, Dom B <[email protected] <javascript:>> 
> wrote:
>
>> Hi,
>>
>> I'm looking at the new Streams API and trying to work out if it's a best 
>> fit for my use case. The problem I'm having is with acknowledgement.
>>
>> I have an external system placing requests onto a queue (Beanstalk in 
>> this case), once the external system receives the OK from beanstalk, like 
>> an event during replay, I'm committed to preforming that job.
>>
>> My plan was to build a ActorPublisher based Beanstalk client based on the 
>> existing Akka IO code, then reserve the jobs on the beanstalk server. This 
>> starts a time to live on the beanstalk server, if I do not delete or 
>> release the job within that window, the server will assume I'm dead and 
>> release the job back onto the queue (
>> https://github.com/kr/beanstalkd/wiki/faq#how-does-ttr-work). This is 
>> perfect in a HA system, because if my Akka node dies, beanstalk will simply 
>> reset the job for another node to process.
>>
>> My problem is once my ActorPublisher gives the job to the "onNext" 
>> method, it has no way to track if and when the job is completed, thus the 
>> only time it can delete from beanstalk is straight away and then I just 
>> lost the whole advantage of the job TTL. 
>>
>> I'm leaning towards a Sink such that the stream has to be 
>> `BeanstalkPublisher ~> F1 ~> F2 ~> BeanstalkDeleter`, but this means the 
>> data type flowing though F1 and F2 has to include the job id. This makes 
>> Flow composition a little more annoying as I had planned to reuse F1 and F2 
>> but without a Beanstalk source.
>>
>> Am I missing something obvious, or is this the only way to achieve an ACK 
>> back to the upstream publisher once F2 has completed processing? (Note in 
>> this example F2 is the persistence point)
>>
>> Cheers,
>>
>> Dom
>>
>> -- 
>> >>>>>>>>>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Akka Team
> Typesafe - Reactive apps on the JVM
> Blog: letitcrash.com
> Twitter: @akkateam
>

-- 
>>>>>>>>>>      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.

Reply via email to