Skip to content

Commit 67c8ff2

Browse files
committed
Refactoring
1 parent 7b7da0c commit 67c8ff2

33 files changed

Lines changed: 445 additions & 177 deletions

TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
* expiring events/TTL?
66
* compact topics - unique key
77
* join, aka streams
8-
* increase code coverage
8+
* more elaborate definitions change support
99
* JavaDocs
1010
* Support schemas init in registry - why require schemas from users, if it is always the same?

src/main/java/com/binaryigor/eventsql/EventSQL.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package com.binaryigor.eventsql;
22

3-
import com.binaryigor.eventsql.impl.EventSQLOps;
4-
import com.binaryigor.eventsql.impl.EventSQLRegistryImpl;
5-
import com.binaryigor.eventsql.impl.TopicDefinitionsCache;
6-
import com.binaryigor.eventsql.impl.sharded.ShardedEventSQLConsumers;
7-
import com.binaryigor.eventsql.impl.sharded.ShardedEventSQLPublisher;
8-
import com.binaryigor.eventsql.impl.sharded.ShardedEventSQLRegistry;
9-
import com.binaryigor.eventsql.impl.sql.SqlConsumerRepository;
10-
import com.binaryigor.eventsql.impl.sql.SqlEventRepository;
11-
import com.binaryigor.eventsql.impl.sql.SqlTopicRepository;
12-
import com.binaryigor.eventsql.impl.sql.SqlTransactions;
3+
import com.binaryigor.eventsql.internal.EventSQLOps;
4+
import com.binaryigor.eventsql.internal.DefaultEventSQLRegistry;
5+
import com.binaryigor.eventsql.internal.TopicDefinitionsCache;
6+
import com.binaryigor.eventsql.internal.sharded.ShardedEventSQLConsumers;
7+
import com.binaryigor.eventsql.internal.sharded.ShardedEventSQLPublisher;
8+
import com.binaryigor.eventsql.internal.sharded.ShardedEventSQLRegistry;
9+
import com.binaryigor.eventsql.internal.sql.SqlConsumerRepository;
10+
import com.binaryigor.eventsql.internal.sql.SqlEventRepository;
11+
import com.binaryigor.eventsql.internal.sql.SqlTopicRepository;
12+
import com.binaryigor.eventsql.internal.sql.SqlTransactions;
1313
import org.jooq.SQLDialect;
1414
import org.jooq.impl.DSL;
1515

@@ -66,7 +66,7 @@ public EventSQL(Collection<DataSource> dataSources,
6666
var consumerRepository = new SqlConsumerRepository(transactions);
6767
var eventRepository = new SqlEventRepository(transactions);
6868

69-
var registry = new EventSQLRegistryImpl(topicRepository, eventRepository, consumerRepository, transactions);
69+
var registry = new DefaultEventSQLRegistry(topicRepository, eventRepository, consumerRepository, transactions);
7070

7171
var topicDefinitionsCache = new TopicDefinitionsCache(topicRepository);
7272
var ops = new EventSQLOps(topicDefinitionsCache, transactions, consumerRepository, eventRepository, clock);

src/main/java/com/binaryigor/eventsql/impl/sql/SimpleJsonMapper.java

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/main/java/com/binaryigor/eventsql/impl/Consumer.java renamed to src/main/java/com/binaryigor/eventsql/internal/Consumer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.binaryigor.eventsql.impl;
1+
package com.binaryigor.eventsql.internal;
22

33
import java.time.Instant;
44

src/main/java/com/binaryigor/eventsql/impl/ConsumerId.java renamed to src/main/java/com/binaryigor/eventsql/internal/ConsumerId.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.binaryigor.eventsql.impl;
1+
package com.binaryigor.eventsql.internal;
22

33
public record ConsumerId(String topic, String name, int partition) {
44
}

src/main/java/com/binaryigor/eventsql/impl/ConsumerRepository.java renamed to src/main/java/com/binaryigor/eventsql/internal/ConsumerRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.binaryigor.eventsql.impl;
1+
package com.binaryigor.eventsql.internal;
22

33
import java.time.Instant;
44
import java.util.Collection;

src/main/java/com/binaryigor/eventsql/impl/ConsumerWrapper.java renamed to src/main/java/com/binaryigor/eventsql/internal/ConsumerWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.binaryigor.eventsql.impl;
1+
package com.binaryigor.eventsql.internal;
22

33
import com.binaryigor.eventsql.Event;
44
import com.binaryigor.eventsql.EventSQLConsumptionException;

src/main/java/com/binaryigor/eventsql/impl/DefaultDLTEventFactory.java renamed to src/main/java/com/binaryigor/eventsql/internal/DefaultDLTEventFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.binaryigor.eventsql.impl;
1+
package com.binaryigor.eventsql.internal;
22

33
import com.binaryigor.eventsql.EventPublication;
44
import com.binaryigor.eventsql.EventSQLConsumers;
@@ -31,7 +31,7 @@ public Optional<EventPublication> create(EventSQLConsumptionException exception,
3131

3232
var cause = exception.getCause();
3333
metadata.put("exceptionType", cause.getClass().getName());
34-
metadata.put("exceptionMessage", cause.getMessage());
34+
metadata.put("exceptionMessage", Optional.ofNullable(cause.getMessage()).orElse(exception.getMessage()));
3535

3636
// TODO: maybe warning, strange situation
3737
var partition = dltTopicDefinitionOpt.get().partitions() < event.partition() ? -1 : dltTopicDefinitionOpt.get().partitions();

src/main/java/com/binaryigor/eventsql/impl/EventSQLRegistryImpl.java renamed to src/main/java/com/binaryigor/eventsql/internal/DefaultEventSQLRegistry.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.binaryigor.eventsql.impl;
1+
package com.binaryigor.eventsql.internal;
22

33
import com.binaryigor.eventsql.ConsumerDefinition;
44
import com.binaryigor.eventsql.EventSQLRegistry;
@@ -11,17 +11,17 @@
1111

1212
import static java.util.stream.Collectors.toList;
1313

14-
public class EventSQLRegistryImpl implements EventSQLRegistry {
14+
public class DefaultEventSQLRegistry implements EventSQLRegistry {
1515

1616
private final TopicRepository topicRepository;
1717
private final EventRepository eventRepository;
1818
private final ConsumerRepository consumerRepository;
1919
private final Transactions transactions;
2020

21-
public EventSQLRegistryImpl(TopicRepository topicRepository,
22-
EventRepository eventRepository,
23-
ConsumerRepository consumerRepository,
24-
Transactions transactions) {
21+
public DefaultEventSQLRegistry(TopicRepository topicRepository,
22+
EventRepository eventRepository,
23+
ConsumerRepository consumerRepository,
24+
Transactions transactions) {
2525
this.topicRepository = topicRepository;
2626
this.eventRepository = eventRepository;
2727
this.consumerRepository = consumerRepository;

src/main/java/com/binaryigor/eventsql/impl/EventRepository.java renamed to src/main/java/com/binaryigor/eventsql/internal/EventRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.binaryigor.eventsql.impl;
1+
package com.binaryigor.eventsql.internal;
22

33
import com.binaryigor.eventsql.Event;
44
import com.binaryigor.eventsql.EventPublication;

0 commit comments

Comments
 (0)