-
Notifications
You must be signed in to change notification settings - Fork 0
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
4 changed files
with
101 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
--- | ||
title: Maven Repository Events | ||
layout: home | ||
nav_order: 10 | ||
--- | ||
|
||
|
||
# Maven Repository Change Detection | ||
|
||
## Synopsis | ||
|
||
This page lists approaches about how to detect changes to artifacts in a Maven repository. | ||
|
||
## Purpose | ||
|
||
The ability to detect changes to a Maven repository allows one to automate several processes: | ||
|
||
* Meta-data generation: Automatically generate VoID, DCAT and PROV-O models from uploaded datasets. | ||
* RDF-Store synchronization: Automatically update an RDF store with information about the Maven repository. Effectively enables querying Maven repositories with Data. | ||
|
||
## Approaches | ||
|
||
### inotifywait | ||
|
||
`inotifywait` is a command line tool capable of watching directories recursively for changes. | ||
It works well on linux distributions - even when invoked within docker containers on a folder mounted from the host. | ||
|
||
The following line will report any closing of a file (after write) or deletion in the repository in the format `EVENTS PATH/FILENAME`: | ||
``` | ||
inotifywait "$HOME/.m2/repository" --recursive --monitor --format '%e %w%f' --event CLOSE_WRITE --event DELETE | ||
``` | ||
|
||
Example output: | ||
``` | ||
CLOSE_WRITE,CLOSE /home/user/.m2/repository/org/example/myproject/myartifact/1.0.0-SNAPSHOT/myartifact-1.0.0-SNAPSHOT.jar | ||
``` | ||
|
||
### Repository Manager Hooks and Plugins | ||
|
||
Repository Managers may either directly support hooks or they may allow for third party plugins that could supply this functionality. | ||
|
||
* Archiva? | ||
* Artifactory? | ||
|
||
Contributions to this section are welcome. | ||
|
||
### Polling | ||
|
||
For completeness, the following script sketches for how one could detect changes to a directory using polling. | ||
The polling could be triggered periodically by a CRON job. | ||
|
||
``` | ||
# Ensure before.txt exists | ||
touch before.txt | ||
# Generate a recursive directory listing | ||
find "$MVN_REPO" | LC_ALL=C sort -u > current.txt | ||
# Compute a diff | ||
diff current.txt before.txt | ||
# Process the diff | ||
# Move current state to prior state | ||
mv current.txt before.txt | ||
``` | ||
|
||
|
||
|
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,20 @@ | ||
--- | ||
title: Messaging | ||
layout: home | ||
nav_order: 10 | ||
--- | ||
|
||
# Messaging | ||
|
||
## Synopsis | ||
|
||
Once changes to a maven repository [are detected](change-detection.md), appropriate messages need to be sent out and relevant components need to be notified. | ||
|
||
## Purpose | ||
|
||
A message queuing system helps to decouple message producers from receivers and adds fault tolerance, such as prevention of data loss in case of server crashes. | ||
|
||
## Apache Kafka | ||
|
||
Apache Kafka is popular, easy to use, and also works from the command line. we just point to the [Quick Start Guide](https://kafka.apache.org/quickstart). | ||
|