FINERACT-1971: Event sequence id int overflow
This commit is contained in:
committed by
Arnold Gálovics
parent
2151b19e27
commit
c22844d432
@@ -6,7 +6,7 @@
|
||||
{
|
||||
"name": "id",
|
||||
"doc": "The ID of the message to be sent",
|
||||
"type": "int"
|
||||
"type": "long"
|
||||
},
|
||||
{
|
||||
"name": "type",
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{
|
||||
"name": "id",
|
||||
"doc": "The ID of the message to be sent",
|
||||
"type": "int"
|
||||
"type": "long"
|
||||
},
|
||||
{
|
||||
"name": "source",
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ public class ExternalEventService {
|
||||
List<BusinessEvent<?>> events = bulkBusinessEvent.get();
|
||||
for (int i = 0; i < events.size(); i++) {
|
||||
BusinessEvent<?> event = events.get(i);
|
||||
int id = i + 1;
|
||||
long id = (long) i + 1;
|
||||
BulkMessageItemV1 message = bulkMessageItemFactory.createBulkMessageItem(id, event);
|
||||
messages.add(message);
|
||||
}
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class BulkMessageItemFactory {
|
||||
private final ByteBufferConverter byteBufferConverter;
|
||||
private final DataEnricherProcessor dataEnricherProcessor;
|
||||
|
||||
public BulkMessageItemV1 createBulkMessageItem(int id, BusinessEvent<?> event) throws IOException {
|
||||
public BulkMessageItemV1 createBulkMessageItem(long id, BusinessEvent<?> event) throws IOException {
|
||||
BusinessEventSerializer eventSerializer = serializerFactory.create(event);
|
||||
ByteBufferSerializable avroDto = dataEnricherProcessor.enrich(eventSerializer.toAvroDTO(event));
|
||||
ByteBuffer buffer = avroDto.toByteBuffer();
|
||||
|
||||
+1
-1
@@ -25,5 +25,5 @@ import lombok.RequiredArgsConstructor;
|
||||
@Getter
|
||||
public class MessageId {
|
||||
|
||||
private final int id;
|
||||
private final long id;
|
||||
}
|
||||
|
||||
+4
-4
@@ -144,7 +144,7 @@ class SendAsynchronousEventsTaskletTest {
|
||||
createExternalEventView("aType", "aCategory", "aSchema", new byte[0], "aIdempotencyKey", 1L),
|
||||
createExternalEventView("aType", "aCategory", "aSchema", new byte[0], "aIdempotencyKey", 1L));
|
||||
// Dummy Message
|
||||
MessageV1 dummyMessage = new MessageV1(1, "aSource", "aType", "nocategory", "aCreateDate", "aBusinessDate", "aTenantId",
|
||||
MessageV1 dummyMessage = new MessageV1(1L, "aSource", "aType", "nocategory", "aCreateDate", "aBusinessDate", "aTenantId",
|
||||
"anidempotencyKey", "aSchema", Mockito.mock(ByteBuffer.class));
|
||||
|
||||
when(repository.findByStatusOrderByBusinessDateAscIdAsc(Mockito.any(), Mockito.any())).thenReturn(events);
|
||||
@@ -166,7 +166,7 @@ class SendAsynchronousEventsTaskletTest {
|
||||
List<ExternalEventView> events = Arrays.asList(
|
||||
createExternalEventView("aType", "aCategory", "aSchema", new byte[0], "aIdempotencyKey", 1L),
|
||||
createExternalEventView("aType", "aCategory", "aSchema", new byte[0], "aIdempotencyKey", 1L));
|
||||
MessageV1 dummyMessage = new MessageV1(1, "aSource", "aType", "nocategory", "aCreateDate", "aBusinessDate", "aTenantId",
|
||||
MessageV1 dummyMessage = new MessageV1(1L, "aSource", "aType", "nocategory", "aCreateDate", "aBusinessDate", "aTenantId",
|
||||
"anidempotencyKey", "aSchema", Mockito.mock(ByteBuffer.class));
|
||||
when(repository.findByStatusOrderByBusinessDateAscIdAsc(Mockito.any(), Mockito.any())).thenReturn(events);
|
||||
when(messageFactory.createMessage(Mockito.any())).thenReturn(dummyMessage);
|
||||
@@ -185,7 +185,7 @@ class SendAsynchronousEventsTaskletTest {
|
||||
// given
|
||||
List<ExternalEventView> events = Arrays
|
||||
.asList(createExternalEventView("aType", "aCategory", "aSchema", new byte[0], "aIdempotencyKey", 1L));
|
||||
MessageV1 dummyMessage = new MessageV1(1, "aSource", "aType", "nocategory", "aCreateDate", "aBusinessDate", "aTenantId",
|
||||
MessageV1 dummyMessage = new MessageV1(1L, "aSource", "aType", "nocategory", "aCreateDate", "aBusinessDate", "aTenantId",
|
||||
"anidempotencyKey", "aSchema", Mockito.mock(ByteBuffer.class));
|
||||
when(repository.findByStatusOrderByBusinessDateAscIdAsc(Mockito.any(), Mockito.any())).thenReturn(events);
|
||||
when(messageFactory.createMessage(Mockito.any())).thenReturn(dummyMessage);
|
||||
@@ -206,7 +206,7 @@ class SendAsynchronousEventsTaskletTest {
|
||||
// given
|
||||
List<ExternalEventView> events = Arrays
|
||||
.asList(createExternalEventView("aType", "aCategory", "aSchema", new byte[0], "aIdempotencyKey", null));
|
||||
MessageV1 dummyMessage = new MessageV1(1, "aSource", "aType", "nocategory", "aCreateDate", "aBusinessDate", "aTenantId",
|
||||
MessageV1 dummyMessage = new MessageV1(1L, "aSource", "aType", "nocategory", "aCreateDate", "aBusinessDate", "aTenantId",
|
||||
"anidempotencyKey", "aSchema", Mockito.mock(ByteBuffer.class));
|
||||
when(repository.findByStatusOrderByBusinessDateAscIdAsc(Mockito.any(), Mockito.any())).thenReturn(events);
|
||||
when(messageFactory.createMessage(Mockito.any())).thenReturn(dummyMessage);
|
||||
|
||||
+1
-1
@@ -180,7 +180,7 @@ class ExternalEventServiceTest {
|
||||
|
||||
String idempotencyKey = "key";
|
||||
BusinessEvent event = mock(BusinessEvent.class);
|
||||
BulkMessageItemV1 messageItem = new BulkMessageItemV1(1, "", "", "", ByteBuffer.wrap(new byte[0]));
|
||||
BulkMessageItemV1 messageItem = new BulkMessageItemV1(1L, "", "", "", ByteBuffer.wrap(new byte[0]));
|
||||
BulkBusinessEvent bulkEvent = new BulkBusinessEvent(List.of(event));
|
||||
byte[] data = new byte[0];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user