-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
810 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>event-store</artifactId> | ||
<groupId>uk.gov.justice.event-store</groupId> | ||
<version>2.0.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>event-store-management</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>javax</groupId> | ||
<artifactId>javaee-api</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>uk.gov.justice.utils</groupId> | ||
<artifactId>utilities-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>uk.gov.justice.event-store</groupId> | ||
<artifactId>published-event-processor</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>uk.gov.justice.services</groupId> | ||
<artifactId>jmx</artifactId> | ||
<version>${framework.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>uk.gov.justice.event-store</groupId> | ||
<artifactId>subscription-manager</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<!--Test Dependencies--> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>uk.gov.justice.services</groupId> | ||
<artifactId>test-utils-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
12 changes: 12 additions & 0 deletions
12
...n/java/uk/gov/justice/services/eventstore/management/catchup/commands/CatchupCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package uk.gov.justice.services.eventstore.management.catchup.commands; | ||
|
||
import uk.gov.justice.services.jmx.command.BaseSystemCommand; | ||
|
||
public class CatchupCommand extends BaseSystemCommand { | ||
|
||
public static final String CATCHUP = "CATCHUP"; | ||
|
||
public CatchupCommand() { | ||
super(CATCHUP); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...uk/gov/justice/services/eventstore/management/catchup/commands/CatchupCommandHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package uk.gov.justice.services.eventstore.management.catchup.commands; | ||
|
||
import static uk.gov.justice.services.eventstore.management.catchup.commands.CatchupCommand.CATCHUP; | ||
|
||
import uk.gov.justice.services.common.util.UtcClock; | ||
import uk.gov.justice.services.eventstore.management.catchup.events.CatchupRequestedEvent; | ||
import uk.gov.justice.services.jmx.command.HandlesSystemCommand; | ||
|
||
import javax.enterprise.event.Event; | ||
import javax.inject.Inject; | ||
|
||
public class CatchupCommandHandler { | ||
|
||
@Inject | ||
private UtcClock utcClock; | ||
|
||
@Inject | ||
private Event<CatchupRequestedEvent> catchupRequestedEventFirer; | ||
|
||
@HandlesSystemCommand(CATCHUP) | ||
public void doCatchup() { | ||
catchupRequestedEventFirer.fire(new CatchupRequestedEvent(new CatchupCommand(), utcClock.now())); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
...ov/justice/services/eventstore/management/catchup/commands/CatchupWithRebuildCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package uk.gov.justice.services.eventstore.management.catchup.commands; | ||
|
||
import uk.gov.justice.services.jmx.command.BaseSystemCommand; | ||
|
||
public class CatchupWithRebuildCommand extends BaseSystemCommand { | ||
|
||
public static final String CATCHUP_WITH_REBUILD = "CATCHUP_WITH_REBUILD"; | ||
|
||
public CatchupWithRebuildCommand() { | ||
super(CATCHUP_WITH_REBUILD); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...ov/justice/services/eventstore/management/catchup/commands/CatchupWithRebuildHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package uk.gov.justice.services.eventstore.management.catchup.commands; | ||
|
||
|
||
import static uk.gov.justice.services.eventstore.management.catchup.commands.CatchupWithRebuildCommand.CATCHUP_WITH_REBUILD; | ||
|
||
import uk.gov.justice.services.common.util.UtcClock; | ||
import uk.gov.justice.services.jmx.command.HandlesSystemCommand; | ||
|
||
import javax.enterprise.event.Event; | ||
import javax.inject.Inject; | ||
|
||
public class CatchupWithRebuildHandler { | ||
|
||
@Inject | ||
private UtcClock clock; | ||
|
||
@Inject | ||
private Event<CatchupWithRebuildRequestedEvent> catchupWithRebuildRequestedEventFirer; | ||
|
||
|
||
@HandlesSystemCommand(CATCHUP_WITH_REBUILD) | ||
public void doCatchupWithRebuild() { | ||
|
||
final CatchupWithRebuildRequestedEvent catchupWithRebuildRequestedEvent = new CatchupWithRebuildRequestedEvent( | ||
new CatchupWithRebuildCommand(), | ||
clock.now() | ||
); | ||
|
||
catchupWithRebuildRequestedEventFirer.fire(catchupWithRebuildRequestedEvent); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...v/justice/services/eventstore/management/catchup/commands/CatchupWithRebuildObserver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package uk.gov.justice.services.eventstore.management.catchup.commands; | ||
|
||
import static java.lang.String.format; | ||
|
||
import javax.enterprise.event.Observes; | ||
import javax.inject.Inject; | ||
|
||
import org.slf4j.Logger; | ||
|
||
public class CatchupWithRebuildObserver { | ||
|
||
@Inject | ||
private Logger logger; | ||
|
||
public void onCatchupWithRebuildRequested(@Observes final CatchupWithRebuildRequestedEvent event) { | ||
|
||
logger.info(format("%s requested at %tc", event.getSystemCommand(), event.getRequestedAt())); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...ice/services/eventstore/management/catchup/commands/CatchupWithRebuildRequestedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package uk.gov.justice.services.eventstore.management.catchup.commands; | ||
|
||
import uk.gov.justice.services.jmx.command.SystemCommand; | ||
|
||
import java.time.ZonedDateTime; | ||
import java.util.Objects; | ||
|
||
public class CatchupWithRebuildRequestedEvent { | ||
|
||
private final SystemCommand systemCommand; | ||
private final ZonedDateTime requestedAt; | ||
|
||
public CatchupWithRebuildRequestedEvent(final SystemCommand systemCommand, final ZonedDateTime requestedAt) { | ||
this.systemCommand = systemCommand; | ||
this.requestedAt = requestedAt; | ||
} | ||
|
||
public SystemCommand getSystemCommand() { | ||
return systemCommand; | ||
} | ||
|
||
public ZonedDateTime getRequestedAt() { | ||
return requestedAt; | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) return true; | ||
if (!(o instanceof CatchupWithRebuildRequestedEvent)) return false; | ||
final CatchupWithRebuildRequestedEvent that = (CatchupWithRebuildRequestedEvent) o; | ||
return Objects.equals(systemCommand, that.systemCommand) && | ||
Objects.equals(requestedAt, that.requestedAt); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(systemCommand, requestedAt); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "CatchupWithRebuildRequestedEvent{" + | ||
"commandName=" + systemCommand + | ||
", requestedAt=" + requestedAt + | ||
'}'; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...a/uk/gov/justice/services/eventstore/management/catchup/events/CatchupCompletedEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package uk.gov.justice.services.eventstore.management.catchup.events; | ||
|
||
import java.time.ZonedDateTime; | ||
import java.util.Objects; | ||
|
||
public class CatchupCompletedEvent { | ||
|
||
private final ZonedDateTime completedAt; | ||
|
||
public CatchupCompletedEvent(final ZonedDateTime completedAt) { | ||
this.completedAt = completedAt; | ||
} | ||
|
||
public ZonedDateTime getCompletedAt() { | ||
return completedAt; | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) return true; | ||
if (!(o instanceof CatchupCompletedEvent)) return false; | ||
final CatchupCompletedEvent that = (CatchupCompletedEvent) o; | ||
return Objects.equals(completedAt, that.completedAt); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(completedAt); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "CatchupCompletedEvent{" + | ||
"completedAt=" + completedAt + | ||
'}'; | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...e/services/eventstore/management/catchup/events/CatchupCompletedForSubscriptionEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package uk.gov.justice.services.eventstore.management.catchup.events; | ||
|
||
import java.time.ZonedDateTime; | ||
import java.util.Objects; | ||
|
||
public class CatchupCompletedForSubscriptionEvent { | ||
|
||
private final String eventSourceName; | ||
private final ZonedDateTime catchupCompletedAt; | ||
private final int totalNumberOfEvents; | ||
|
||
public CatchupCompletedForSubscriptionEvent( | ||
final String eventSourceName, | ||
final int totalNumberOfEvents, | ||
final ZonedDateTime catchupCompletedAt) { | ||
|
||
this.eventSourceName = eventSourceName; | ||
this.catchupCompletedAt = catchupCompletedAt; | ||
this.totalNumberOfEvents = totalNumberOfEvents; | ||
} | ||
|
||
public String getEventSourceName() { | ||
return eventSourceName; | ||
} | ||
|
||
public ZonedDateTime getCatchupCompletedAt() { | ||
return catchupCompletedAt; | ||
} | ||
|
||
public int getTotalNumberOfEvents() { | ||
return totalNumberOfEvents; | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) return true; | ||
if (!(o instanceof CatchupCompletedForSubscriptionEvent)) return false; | ||
final CatchupCompletedForSubscriptionEvent that = (CatchupCompletedForSubscriptionEvent) o; | ||
return totalNumberOfEvents == that.totalNumberOfEvents && | ||
Objects.equals(eventSourceName, that.eventSourceName) && | ||
Objects.equals(catchupCompletedAt, that.catchupCompletedAt); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(eventSourceName, catchupCompletedAt, totalNumberOfEvents); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "CatchupCompletedForSubscriptionEvent{" + | ||
"eventSourceName='" + eventSourceName + '\'' + | ||
", catchupCompletedAt=" + catchupCompletedAt + | ||
", totalNumberOfEvents=" + totalNumberOfEvents + | ||
'}'; | ||
} | ||
} |
Oops, something went wrong.