From ab48d2e8e104f2c0441760c7ddd29963883fee93 Mon Sep 17 00:00:00 2001 From: Kevin Millar Date: Sat, 13 Jun 2026 21:32:40 +1000 Subject: [PATCH 1/2] Upgrade packages to latest --- cmd/bank/main.go | 2 +- domain/deposit.go | 8 ++++---- domain/openaccount.go | 6 +++--- domain/transfer.go | 34 +++++++++++++++++++--------------- domain/withdrawal.go | 6 +++--- go.mod | 6 +++--- go.sum | 36 ++++++++++++++++++------------------ 7 files changed, 51 insertions(+), 47 deletions(-) diff --git a/cmd/bank/main.go b/cmd/bank/main.go index f915b46..29dbb9f 100644 --- a/cmd/bank/main.go +++ b/cmd/bank/main.go @@ -44,7 +44,7 @@ func main() { fact.EventRecordedByAggregate, fact.EventRecordedByIntegration, fact.CommandExecutedByProcess, - fact.TimeoutScheduledByProcess, + fact.DeadlineScheduledByProcess, fact.MessageLoggedByAggregate, fact.MessageLoggedByIntegration, fact.MessageLoggedByProcess, diff --git a/domain/deposit.go b/domain/deposit.go index d95aa4e..9b7f2cb 100644 --- a/domain/deposit.go +++ b/domain/deposit.go @@ -13,7 +13,7 @@ import ( // account. type DepositProcessHandler struct { dogma.StatelessProcessBehavior - dogma.NoTimeoutMessagesBehavior[dogma.StatelessProcessRoot] + dogma.NoDeadlineMessagesBehavior[*dogma.StatelessProcessRoot] } // Configure configures the behavior of the engine as it relates to this @@ -30,7 +30,7 @@ func (DepositProcessHandler) Configure(c dogma.ProcessConfigurer) { ) } -// RouteEventToInstance returns the ID of the process instance that is targetted +// RouteEventToInstance returns the ID of the process instance that is targeted // by m. func (DepositProcessHandler) RouteEventToInstance( _ context.Context, @@ -51,8 +51,8 @@ func (DepositProcessHandler) RouteEventToInstance( // HandleEvent handles an event message that has been routed to this handler. func (DepositProcessHandler) HandleEvent( _ context.Context, - _ dogma.StatelessProcessRoot, - s dogma.ProcessEventScope[dogma.StatelessProcessRoot], + _ *dogma.StatelessProcessRoot, + s dogma.ProcessEventScope[*dogma.StatelessProcessRoot], m dogma.Event, ) error { switch x := m.(type) { diff --git a/domain/openaccount.go b/domain/openaccount.go index 4eef8ec..9a535e1 100644 --- a/domain/openaccount.go +++ b/domain/openaccount.go @@ -12,7 +12,7 @@ import ( // initial account for a new customer. type OpenAccountForNewCustomerProcessHandler struct { dogma.StatelessProcessBehavior - dogma.NoTimeoutMessagesBehavior[dogma.StatelessProcessRoot] + dogma.NoDeadlineMessagesBehavior[*dogma.StatelessProcessRoot] } // Configure configures the behavior of the engine as it relates to this @@ -43,8 +43,8 @@ func (OpenAccountForNewCustomerProcessHandler) RouteEventToInstance( // HandleEvent handles an event message that has been routed to this handler. func (OpenAccountForNewCustomerProcessHandler) HandleEvent( _ context.Context, - _ dogma.StatelessProcessRoot, - s dogma.ProcessEventScope[dogma.StatelessProcessRoot], + _ *dogma.StatelessProcessRoot, + s dogma.ProcessEventScope[*dogma.StatelessProcessRoot], m dogma.Event, ) error { switch x := m.(type) { diff --git a/domain/transfer.go b/domain/transfer.go index 0f9b638..eb8ee3d 100644 --- a/domain/transfer.go +++ b/domain/transfer.go @@ -13,7 +13,7 @@ import ( ) func init() { - dogma.RegisterTimeout[*TransferReadyToProceed]("b5474f89-e985-4661-b85b-645347a4a645") + dogma.RegisterDeadline[*TransferReadyToProceed]("b5474f89-e985-4661-b85b-645347a4a645") } // transfer is the process root for a funds transfer. @@ -101,11 +101,11 @@ func (TransferProcessHandler) Configure(c dogma.ProcessConfigurer) { dogma.ExecutesCommand[*commands.ApproveTransfer](), dogma.ExecutesCommand[*commands.DeclineTransfer](), dogma.ExecutesCommand[*commands.MarkTransferAsFailed](), - dogma.SchedulesTimeout[*TransferReadyToProceed](), + dogma.SchedulesDeadline[*TransferReadyToProceed](), ) } -// RouteEventToInstance returns the ID of the process instance that is targetted +// RouteEventToInstance returns the ID of the process instance that is targeted // by m. func (TransferProcessHandler) RouteEventToInstance( _ context.Context, @@ -148,12 +148,14 @@ func (TransferProcessHandler) HandleEvent( ) error { switch x := m.(type) { case *events.TransferStarted: - t.FromAccountID = x.FromAccountID - t.ToAccountID = x.ToAccountID - t.ToThirdPartyBank = x.ToThirdPartyBank - t.Amount = x.Amount + s.Mutate(func(t *transferProcess) { + t.FromAccountID = x.FromAccountID + t.ToAccountID = x.ToAccountID + t.ToThirdPartyBank = x.ToThirdPartyBank + t.Amount = x.Amount + }) - s.ScheduleTimeout( + s.ScheduleDeadline( &TransferReadyToProceed{ TransactionID: x.TransactionID, }, @@ -195,7 +197,9 @@ func (TransferProcessHandler) HandleEvent( } case *events.DailyDebitLimitExceeded: - t.DeclineReason = messages.DailyDebitLimitExceeded + s.Mutate(func(t *transferProcess) { + t.DeclineReason = messages.DailyDebitLimitExceeded + }) // compensate the initial debit s.ExecuteCommand(&commands.CreditAccount{ @@ -258,12 +262,12 @@ func (TransferProcessHandler) HandleEvent( return nil } -// HandleTimeout handles a timeout message that has been routed to this handler. -func (TransferProcessHandler) HandleTimeout( +// HandleDeadline handles a deadline message that has been routed to this handler. +func (TransferProcessHandler) HandleDeadline( _ context.Context, t *transferProcess, - s dogma.ProcessTimeoutScope[*transferProcess], - m dogma.Timeout, + s dogma.ProcessDeadlineScope[*transferProcess], + m dogma.Deadline, ) error { switch x := m.(type) { case *TransferReadyToProceed: @@ -282,7 +286,7 @@ func (TransferProcessHandler) HandleTimeout( return nil } -// TransferReadyToProceed is a timeout message notifiying that the transfer is +// TransferReadyToProceed is a deadline message notifying that the transfer is // ready to proceed. type TransferReadyToProceed struct { TransactionID string @@ -294,7 +298,7 @@ func (m *TransferReadyToProceed) MessageDescription() string { } // Validate returns a non-nil error if the message is invalid. -func (m *TransferReadyToProceed) Validate(dogma.TimeoutValidationScope) error { +func (m *TransferReadyToProceed) Validate(dogma.DeadlineValidationScope) error { if m.TransactionID == "" { return errors.New("TransferReadyToProceed must not have an empty transaction ID") } diff --git a/domain/withdrawal.go b/domain/withdrawal.go index da755d0..383aade 100644 --- a/domain/withdrawal.go +++ b/domain/withdrawal.go @@ -13,7 +13,7 @@ import ( // account. type WithdrawalProcessHandler struct { dogma.StatelessProcessBehavior - dogma.NoTimeoutMessagesBehavior[dogma.StatelessProcessRoot] + dogma.NoDeadlineMessagesBehavior[*dogma.StatelessProcessRoot] } // Configure configures the behavior of the engine as it relates to this @@ -69,8 +69,8 @@ func (WithdrawalProcessHandler) RouteEventToInstance( // HandleEvent handles an event message that has been routed to this handler. func (WithdrawalProcessHandler) HandleEvent( _ context.Context, - _ dogma.StatelessProcessRoot, - s dogma.ProcessEventScope[dogma.StatelessProcessRoot], + _ *dogma.StatelessProcessRoot, + s dogma.ProcessEventScope[*dogma.StatelessProcessRoot], m dogma.Event, ) error { switch x := m.(type) { diff --git a/go.mod b/go.mod index 3928d2d..cd9eaa7 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/dogmatiq/example go 1.26 require ( - github.com/dogmatiq/dogma v0.23.0 - github.com/dogmatiq/enginekit v0.25.0 + github.com/dogmatiq/dogma v0.25.0 + github.com/dogmatiq/enginekit v0.26.5 github.com/dogmatiq/projectionkit v0.10.0 github.com/dogmatiq/testkit v0.21.1 github.com/google/uuid v1.6.0 @@ -15,7 +15,7 @@ require ( require ( filippo.io/edwards25519 v1.1.1 // indirect github.com/dogmatiq/cosyne v0.2.0 // indirect - github.com/dogmatiq/dapper v0.6.0 // indirect + github.com/dogmatiq/dapper v0.6.1 // indirect github.com/dogmatiq/iago v0.4.0 // indirect github.com/dogmatiq/jumble v0.1.0 // indirect github.com/dogmatiq/linger v1.1.0 // indirect diff --git a/go.sum b/go.sum index 889910d..a50d3f8 100644 --- a/go.sum +++ b/go.sum @@ -33,12 +33,12 @@ github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4 github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dogmatiq/cosyne v0.2.0 h1:tO957BpS4I9kqSw31ds6Ef4CXvV8zPAqWzbXKElsGWg= github.com/dogmatiq/cosyne v0.2.0/go.mod h1:dD8EZjbRX7FFw9t6P7l1nwoZbA7YxtOCfl9ZZAHPucU= -github.com/dogmatiq/dapper v0.6.0 h1:hnWUsjnt3nUiC9hmkPvuxrnMd7fYNz1i+/GS3gOx0Xs= -github.com/dogmatiq/dapper v0.6.0/go.mod h1:ubRHWzt73s0MsPpGhWvnfW/Z/1YPnrkCsQv6CUOZVEw= -github.com/dogmatiq/dogma v0.23.0 h1:Be89oJvamKPRV/yCETJ59/08z2iD62slR3Y+DXvGsKU= -github.com/dogmatiq/dogma v0.23.0/go.mod h1:BNKrZq9wm3jRu35XUWQXkMRhq4EzYK+rOVbGjrbCVyI= -github.com/dogmatiq/enginekit v0.25.0 h1:Q26n/QS/donESYDc1KG8snKBbriunBVLlW2/Jokcv28= -github.com/dogmatiq/enginekit v0.25.0/go.mod h1:OLpNQbousZdME2gsSbIgdy9/6F5iJwmvv9rDoCTULTI= +github.com/dogmatiq/dapper v0.6.1 h1:4hRKC6IyQbP5D603D8hBWRbA4hT55rgB3Of0bNjTkwQ= +github.com/dogmatiq/dapper v0.6.1/go.mod h1:TeeI2qSWx22eOT8zuvObWJp544rggYs9NIdGWx2AeCc= +github.com/dogmatiq/dogma v0.25.0 h1:L1NM8xBaQMyJ+oFSKSH9FWqyQyf91I50qFN/Bz4WsT0= +github.com/dogmatiq/dogma v0.25.0/go.mod h1:BNKrZq9wm3jRu35XUWQXkMRhq4EzYK+rOVbGjrbCVyI= +github.com/dogmatiq/enginekit v0.26.5 h1:h1lQ+jgbf4+E5K4Qkyq/hsD23a4y7QnQM47ouKh6zd0= +github.com/dogmatiq/enginekit v0.26.5/go.mod h1:hxoY+kQvM/57wJO7O0OMwoQ/D0XE1qXRyybIjY4XfJ8= github.com/dogmatiq/iago v0.4.0 h1:57nZqVT34IZxtCZEW/RFif7DNUEjMXgevfr/Mmd0N8I= github.com/dogmatiq/iago v0.4.0/go.mod h1:fishMWBtzYcjgis6d873VTv9kFm/wHYLOzOyO9ECBDc= github.com/dogmatiq/jumble v0.1.0 h1:Cb3ExfxY+AoUP4G9/sOwoOdYX8o+kOLK8+dhXAry+QA= @@ -47,8 +47,8 @@ github.com/dogmatiq/linger v1.1.0 h1:kGL9sL79qRa6Cr8PhadeJ/ptbum+b48pAaNWWlyVVKg github.com/dogmatiq/linger v1.1.0/go.mod h1:OOWJUwTxNkFolhuVdaTYjO4FmFLjZHZ8EMc5H5qOJ7Q= github.com/dogmatiq/projectionkit v0.10.0 h1:OXvgmyIUeJme2HdRhCa07LF4Xfhc0xYWpwDhYQfi9SQ= github.com/dogmatiq/projectionkit v0.10.0/go.mod h1:vs+JNhmeB5lhqPdOv5QfkGt56ZonikUCUjualGnLG8U= -github.com/dogmatiq/testkit v0.21.1 h1:oSd0n6Hct82z4UArM6pbxK2U16br+CwF81s9+WQaVsU= -github.com/dogmatiq/testkit v0.21.1/go.mod h1:wD0t07dKTT5wbTczXe5IF94Q6VTE79c5x1auFLlrIj8= +github.com/dogmatiq/testkit v0.21.2-0.20260610223352-5bc83859f175 h1:pkJ7ffStEhsnYKJG0YI2YwJITPJ34elsHBU40ojbJFM= +github.com/dogmatiq/testkit v0.21.2-0.20260610223352-5bc83859f175/go.mod h1:VAGTIFOLktMMXcaiey9y4SOcWpa68qDQwB90HU34d8M= github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw= github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= @@ -167,12 +167,12 @@ go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw= -go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I= -go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0= -go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM= -go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY= -go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A= -go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0= +go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU= +go.opentelemetry.io/otel v1.44.0/go.mod h1:BMgjTHL9WPRlRjL2oZCBTL4whCGtXch2H4BhOPIAyYc= +go.opentelemetry.io/otel/metric v1.44.0 h1:1w0gILTcHdr3YI+ixLyjemwrVnsMURbTZFrSYCdDdmc= +go.opentelemetry.io/otel/metric v1.44.0/go.mod h1:8O7hanEPBNgEMmybD3s2VBKcgWOCsA6tzHBPODAiquo= +go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk= +go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -186,8 +186,8 @@ golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4= -golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= +golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM= +golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -202,8 +202,8 @@ golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= -golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= +golang.org/x/text v0.38.0 h1:sXmwo9DwP3OK9EZ7PqAdaooSGozfl/3a6/xJcbzPRhE= +golang.org/x/text v0.38.0/go.mod h1:YXZt3QhHUKYT53r2lLKFIVi6Ao1jdzrTR/KQ09qyxF4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= From 3c4671d9585f92dadb2c29530d6170f2d9f18b1f Mon Sep 17 00:00:00 2001 From: James Harris Date: Wed, 24 Jun 2026 05:41:08 +1000 Subject: [PATCH 2/2] Update testkit to v0.22.0. --- go.mod | 4 ++-- go.sum | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index cd9eaa7..4695274 100644 --- a/go.mod +++ b/go.mod @@ -6,10 +6,10 @@ require ( github.com/dogmatiq/dogma v0.25.0 github.com/dogmatiq/enginekit v0.26.5 github.com/dogmatiq/projectionkit v0.10.0 - github.com/dogmatiq/testkit v0.21.1 + github.com/dogmatiq/testkit v0.22.0 github.com/google/uuid v1.6.0 github.com/mattn/go-sqlite3 v1.14.46 - golang.org/x/text v0.36.0 + golang.org/x/text v0.38.0 ) require ( diff --git a/go.sum b/go.sum index a50d3f8..714cb2c 100644 --- a/go.sum +++ b/go.sum @@ -47,8 +47,8 @@ github.com/dogmatiq/linger v1.1.0 h1:kGL9sL79qRa6Cr8PhadeJ/ptbum+b48pAaNWWlyVVKg github.com/dogmatiq/linger v1.1.0/go.mod h1:OOWJUwTxNkFolhuVdaTYjO4FmFLjZHZ8EMc5H5qOJ7Q= github.com/dogmatiq/projectionkit v0.10.0 h1:OXvgmyIUeJme2HdRhCa07LF4Xfhc0xYWpwDhYQfi9SQ= github.com/dogmatiq/projectionkit v0.10.0/go.mod h1:vs+JNhmeB5lhqPdOv5QfkGt56ZonikUCUjualGnLG8U= -github.com/dogmatiq/testkit v0.21.2-0.20260610223352-5bc83859f175 h1:pkJ7ffStEhsnYKJG0YI2YwJITPJ34elsHBU40ojbJFM= -github.com/dogmatiq/testkit v0.21.2-0.20260610223352-5bc83859f175/go.mod h1:VAGTIFOLktMMXcaiey9y4SOcWpa68qDQwB90HU34d8M= +github.com/dogmatiq/testkit v0.22.0 h1:AGZggJEkbLk12RqtWjk7fxtheb48UtZpgbSU0hMvlgQ= +github.com/dogmatiq/testkit v0.22.0/go.mod h1:VAGTIFOLktMMXcaiey9y4SOcWpa68qDQwB90HU34d8M= github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw= github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=