Skip to content

Commit

Permalink
Revert "Pushback i lesing av hendelser fra fpsak (#1981)" (#1985)
Browse files Browse the repository at this point in the history
This reverts commit ea74be4.
  • Loading branch information
palfi authored Aug 11, 2023
1 parent 091b5f0 commit 8501b77
Showing 1 changed file with 1 addition and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public class BehandlingHendelseConsumer implements LiveAndReadinessAware, Contro
private static final Environment ENV = Environment.current();

private static final String PROD_APP_ID = "fplos-behandling"; // Hold konstant pga offset commit !!
private static final int HANDLE_MESSAGE_INTERVAL_MILLIS = 20;

private String topicName;
private KafkaStreams stream;
Expand All @@ -43,23 +42,11 @@ public BehandlingHendelseConsumer(@KonfigVerdi(value = "kafka.behandlinghendelse
final Consumed<String, String> consumed = Consumed.with(Topology.AutoOffsetReset.EARLIEST);

final StreamsBuilder builder = new StreamsBuilder();
builder.stream(topicName, consumed).foreach((key, payload) -> {
behandlingHendelseHåndterer.handleMessage(key, payload);
sleep();
});
builder.stream(topicName, consumed).foreach(behandlingHendelseHåndterer::handleMessage);

this.stream = new KafkaStreams(builder.build(), KafkaProperties.forStreamsStringValue(getApplicationId()));
}

private static void sleep() {
try {
Thread.sleep(HANDLE_MESSAGE_INTERVAL_MILLIS);
} catch (InterruptedException e) {
LOG.warn("Interrupt!", e);
Thread.currentThread().interrupt();
}
}

@Override
public void start() {
addShutdownHooks();
Expand Down

0 comments on commit 8501b77

Please sign in to comment.