Skip to content
Discussion options

You must be logged in to vote

@rsmidt Maybe sourceProvider could be wrapped to add throttling to the source?

JdbcProjection.atLeastOnce(
    ProjectionId.of(PROJECTION_NAME, tag),
    new SourceProvider[Offset, Envelope] {
        val wrapped = sourceProvider

        override def source(offset: () => Future[Option[Long]]): Future[Source[Envelope, NotUsed]] =
          wrapped.source(offset).map(_.throttle(1, 1.second))

        override def extractOffset(envelope: Envelope): Long = wrapped.extractOffset(envelope)

        override def extractCreationTime(envelope: Envelope): Long = wrapped.extractOffset(envelope)
      },
    ...
)

Replies: 4 comments 13 replies

Comment options

You must be logged in to vote
1 reply
@rsmidt
Comment options

Comment options

You must be logged in to vote
3 replies
@ptrdom
Comment options

ptrdom Nov 6, 2025
Collaborator

@pjfanning
Comment options

@rsmidt
Comment options

Comment options

You must be logged in to vote
6 replies
@mdedetrich
Comment options

@ptrdom
Comment options

ptrdom Nov 6, 2025
Collaborator

@mdedetrich
Comment options

@ptrdom
Comment options

ptrdom Nov 6, 2025
Collaborator

@mdedetrich
Comment options

Comment options

You must be logged in to vote
3 replies
@rsmidt
Comment options

@pjfanning
Comment options

@rsmidt
Comment options

Answer selected by rsmidt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants