Rust replacement for the Java event-importer CLI.
It supports the two portal migration workflows:
- Import a JSON array of CloudEvents into
event_store_t,outbox_message_t, and pendingnotification_t. - Convert a portal snapshot JSON file into CreatedEvents that can be imported by the same import path.
cargo build --releaseThe binary is created at target/release/importer.
Create a GitHub release and upload Linux plus macOS Apple Silicon archives:
./release.sh v0.1.0The script creates:
dist/importer-v0.1.0-linux-x86_64.tar.gzdist/importer-v0.1.0-macos-aarch64.tar.gzdist/SHA256SUMS
Requirements:
ghauthenticated with permission to create/upload releases.rustuptargets forx86_64-unknown-linux-gnuandaarch64-apple-darwin. The script installs missing targets whenrustupis available.- For cross-building macOS Apple Silicon from Linux, install
zigandcargo-zigbuild, or run the release script on macOS. Without those tools, publish Linux only withBUILD_MACOS=0 ./release.sh v0.1.0.
On Linux, install the Rust cross-build helper with:
cargo install cargo-zigbuildInstall zig from your OS package manager or from https://ziglang.org/download/.
Useful release options:
BUILD_MACOS=0 ./release.sh v0.1.0
BUILD_LINUX=0 ./release.sh v0.1.0
UPLOAD=0 ./release.sh v0.1.0
ALLOW_DIRTY=1 ./release.sh v0.1.0Import mode writes to PostgreSQL and requires DATABASE_URL:
export DATABASE_URL=postgres://postgres:secret@localhost:5432/configserverOptional:
export IMPORTER_DB_MAX_CONNECTIONS=3
export RUST_LOG=infoimporter import --filename events.jsonLegacy Java-compatible form:
importer --filename events.jsonUseful options:
importer import \
--filename events.json \
--replacement '[{"field":"hostId","from":"OLD_HOST_UUID","to":"NEW_HOST_UUID"}]' \
--batch-size 500Use --dry-run to parse, mutate, and validate without database access. Dry-run
does not simulate target-database skips, so skippedExistingTarget remains 0.
--filename - reads from stdin.
importer convert \
--filename snapshot.json \
--target-host-id 01964b05-552a-7c4b-9184-6857e7f3dc5f \
--admin-user-id 01964b05-5532-7c79-8cde-191dcbd421b8 \
--output events.jsonLegacy Java-compatible form:
importer --convert \
--filename snapshot.json \
--targetHostId 01964b05-552a-7c4b-9184-6857e7f3dc5f \
--adminUserId 01964b05-5532-7c79-8cde-191dcbd421b8 \
--output events.jsonConvert and import without writing an intermediate file:
importer convert \
--filename snapshot.json \
--target-host-id 01964b05-552a-7c4b-9184-6857e7f3dc5f \
--admin-user-id 01964b05-5532-7c79-8cde-191dcbd421b8 \
--output - \
| importer import --filename - --batch-size 500Snapshot conversion defaults to the embedded portal table dependency graph. Use
--schema-source database to validate ordering against live PostgreSQL
metadata.
Replacement rules may use the Java aliases:
[
{"field":"hostId","from":"OLD_HOST_UUID","to":"NEW_HOST_UUID"}
]or:
[
{"fieldName":"hostId","fromValue":"OLD_HOST_UUID","toValue":"NEW_HOST_UUID"}
]Enrichment rules support generateUUID, mapGenerate, and the README legacy
alias mapAndGenerate.