Skip to content

Migrate surf-transaction to Microservice Architecture with RabbitMQ#11

Draft
Copilot wants to merge 3 commits intoversion/1.21.11from
copilot/analyze-target-project-modules
Draft

Migrate surf-transaction to Microservice Architecture with RabbitMQ#11
Copilot wants to merge 3 commits intoversion/1.21.11from
copilot/analyze-target-project-modules

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 25, 2026

Migrates surf-transaction from a monolithic core module (direct DB access on Paper/Velocity) to a proper microservice architecture where client plugins communicate with a standalone microservice via RabbitMQ.

Module restructure

Module Before After
surf-transaction-core All implementation Pure Gradle container (no src/)
surf-transaction-core-common NEW Shared DTOs, Core*Service interfaces, Redis, RabbitMQ packets
surf-transaction-core-client NEW RabbitMQ-backed service impls (@AutoService)
surf-transaction-microservice NEW Standalone microservice: DB, handlers, entry point
surf-transaction-paper/velocity Depends on :core Depends on :core:core-client, CLIENT_API RabbitMQ

Core interfaces

Introduced CoreAccountService, CoreCurrencyService, CoreTransactionService extending the API interfaces with the extra methods (e.g. getDefaultAccount, deleteAccount, addMemberToAccount). TransactionalImpl, AccountAccessImpl, and AccountMemberOperationsImpl now resolve to these via service locator — transparently dispatching to either DB-backed or RabbitMQ-backed impls depending on the JVM.

RabbitMQ packets (core-common)

16 @Serializable Request/Response pairs covering all service operations. TransactionResultPacket is a new sealed class for safe wire transport of TransactionResult subtypes.

@Serializable
class DepositRequest(
    val accountId: SerializableStringUUID,
    val initiator: SerializableStringUUID,
    val amount: SerializableBigDecimal,
    val currencyName: String,
    val ignoreMinimum: Boolean,
    val additionalData: Set<TransactionData>
) : RabbitRequestPacket<DepositResponse>()

Microservice entry point & handler

TransactionMicroservice bootstraps the instance and registers TransactionRabbitHandler. All @RabbitHandler methods use request.launch {} (no runBlocking) since RabbitRequestPacket implements CoroutineScope.

@RabbitHandler
fun handleDeposit(request: DepositRequest) {
    request.launch {
        val result = CoreTransactionService.get().deposit(...)
        request.respond(DepositResponse(result.toPacket()))
    }
}

Serialization additions

  • @Serializable added to: AccountDeleteResult, AccountMemberResult, AccountCreationResult.FailureReason, CurrencyCreateResult, CurrencyDefaultResult, TransactionImpl
  • Binary compatibility file updated to reflect new serializer() companion methods on affected enums

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Analyze module structure of target project Migrate surf-transaction to Microservice Architecture with RabbitMQ Mar 25, 2026
Copilot AI requested a review from twisti-dev March 25, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants