Skip to content

chore(next): Unify rabbitmq starter with starter eda #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import io.cloudevents.CloudEvent;
import io.cloudevents.CloudEventData;
import lombok.SneakyThrows;
import lombok.experimental.UtilityClass;

Expand All @@ -16,6 +17,10 @@ public static byte[] asBytes(Object object) {
return mapper.writeValueAsBytes(object);
}

public static CloudEventData asCloudEventData(Object object) {
return () -> asBytes(object);
}

@SneakyThrows
public static <T> T fromCloudEventData(CloudEvent cloudEvent, Class<T> classValue) {
return mapper.readValue(Objects.requireNonNull(cloudEvent.getData()).toBytes(), classValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ void shouldStartListener() {
Headers header = new RecordHeaders().add("contentType", "application/json".getBytes(StandardCharsets.UTF_8));
when(record.headers()).thenReturn(header);
when(record.key()).thenReturn("key");
ReceiverOffset receiverOffset = mock(ReceiverOffset.class);
when(record.receiverOffset()).thenReturn(receiverOffset);

Flux<ReceiverRecord<String, byte[]>> flux = Flux.just(record);
when(receiver.listen(anyString(), any(List.class))).thenReturn(flux);
Expand All @@ -91,7 +89,6 @@ void shouldStartListener() {
StepVerifier.create(flow).expectNext("").verifyComplete();
// Assert
verify(topologyCreator, times(1)).createTopics(any(List.class));
verify(receiverOffset, atLeastOnce()).acknowledge();
}


Expand Down
Loading
Loading