You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "He-Pin (via GitHub)" <gi...@apache.org> on 2024/03/14 14:19:58 UTC

[I] Feature request: Add Source#generate and iteratee methods. [incubator-pekko]

He-Pin opened a new issue, #1189:
URL: https://github.com/apache/incubator-pekko/issues/1189

   Motivation:
   In production, I was try to using Reactor-core, but which cause in production outage. 
   When Using Pekko-Stream with `unfold`, which is a little heavy with the `Optional` and `Pair` in Java dsl.
   
   ```java
           final Source<String, NotUsed> idFlux = Source.unfold(NotUsed.notUsed(), state -> {
               try {
                   //这里故意使用同步take,因为flux 只在这个类中用到了。
                   return Optional.of(Pair.create(NotUsed.notUsed(), queue.take()));
               } catch (Throwable e) {
                   errLogger.error("failed to take connectId from queue", e);
                   return Optional.of(Pair.create(NotUsed.notUsed(), ""));
               }
           });
   ```
   
   I think we can add something like `generate` for infinity stream and `iterate` with a predicate.
   ```scala
   generate[T](f: () => T): Source[T, NotUsed]
   
   iterate[T](seed:T, hasNext: T => Boolean, nextGenerator: T => T): Source[T, NotUsed]
   iterate[T](seed:T,nextGenerator: T => T) : Source[T, NotUsed]
   ```
   
   This will be very useful in Javadsl.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] Feature request: Add Source#generate and iteratee methods. [incubator-pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on issue #1189:
URL: https://github.com/apache/incubator-pekko/issues/1189#issuecomment-2003410310

   @pjfanning @mdedetrich @Roiocam Wdyt about this?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] Feature request: Add Source#generate and iteratee methods. [incubator-pekko]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on issue #1189:
URL: https://github.com/apache/incubator-pekko/issues/1189#issuecomment-2003486068

   not against this - just want to press on with 1.1.0-M1 - so if you target it to 1.1.0-M2, that is fine with me


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] Feature request: Add Source#generate and iteratee methods. [incubator-pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on issue #1189:
URL: https://github.com/apache/incubator-pekko/issues/1189#issuecomment-2003669409

   Thanks, I will give this a try this weekend.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [I] Feature request: Add Source#generate and iteratee methods. [pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin closed issue #1189: Feature request: Add Source#generate and iteratee methods.
URL: https://github.com/apache/pekko/issues/1189


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org