Skip to content

Commit

Permalink
Remove deprecated elements of the public API.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalloc committed Sep 26, 2023
1 parent e82b117 commit 9c123a0
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 153 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,26 @@ The format is based on [Keep a Changelog], and this project adheres to
[keep a changelog]: https://keepachangelog.com/en/1.0.0/
[semantic versioning]: https://semver.org/spec/v2.0.0.html

## Unreleased - ETA 2023-10-09

### Removed

This release marks 6 months since the release of [0.12.0], which deprecated
several elements of the API. Those elements have been removed in this release.

- **[BC]** Remove deprecated message routing methods (use `.Route()` instead)
- `AggregateConfigurer.ConsumesCommandType()`
- `AggregateConfigurer.ProducesEventType()`
- `ProcessConfigurer.ConsumesEventType()`
- `ProcessConfigurer.ProducesCommandType()`
- `ProcessConfigurer.SchedulesTimeoutType()`
- `IntegrationConfigurer.ConsumesCommandType()`
- `IntegrationConfigurer.ProducesEventType()`
- `ProjectionConfigurer.ConsumesEventType()`
- **[BC]** Removed `DescribableMessage` interface and `DescribeMessage()`
- **[BC]** Removed `ValidateableMessage` interface and `ValidateMessage()`
- **[BC]** Removed `EventRecorder` interface

## [0.12.1] - 2023-06-14

### Changed
Expand Down
9 changes: 0 additions & 9 deletions external.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,3 @@ type CommandExecutor interface {
// returns.
ExecuteCommand(context.Context, Command) error
}

// EventRecorder records events outside of a Dogma message handler.
//
// Deprecated: No production engines implement this interface. To record
// arbitrary events implement an [IntegrationMessageHandler] instead.
type EventRecorder interface {
// RecordEvent records the occurrence of an event.
RecordEvent(context.Context, Event) error
}
2 changes: 1 addition & 1 deletion fixtures/message_deprecated.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package fixtures
import "fmt"

// MessageA is a type used as a dogma.Message in tests.
// Deprecated: Use [Command], [Event] or [Timeout] instead.
// Deprecated: Use [TestCommand], [TestEvent] or [TestTimeout] instead.
type MessageA struct {
Value any
}
Expand Down
24 changes: 0 additions & 24 deletions integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,30 +56,6 @@ type IntegrationConfigurer interface {
// Integration handlers support the HandlesCommand() and RecordsEvent()
// route types.
Routes(...IntegrationRoute)

// ConsumesCommandType configures the engine to route commands of a specific
// type to the handler.
//
// The application's configuration MUST route each command type to a single
// handler.
//
// The command SHOULD be the zero-value of its type; the engine uses the
// type information, but not the value itself.
//
// Deprecated: Use IntegrationConfigurer.Routes() instead.
ConsumesCommandType(Command)

// ProducesEventType configures the engine to use the handler as the source
// of events of a specific type.
//
// The application's configuration MUST source each event type from a single
// handler.
//
// The event SHOULD be the zero-value of its type; the engine uses the type
// information, but not the value itself.
//
// Deprecated: Use IntegrationConfigurer.Routes() instead.
ProducesEventType(Event)
}

// IntegrationCommandScope performs engine operations within the context of a
Expand Down
33 changes: 0 additions & 33 deletions message.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package dogma

import "errors"

// A Message is an application-defined unit of data that describes a [Command],
// [Event], or [Timeout] within a message-based application.
type Message interface {
Expand Down Expand Up @@ -29,34 +27,3 @@ type Timeout = Message
var UnexpectedMessage unexpectedMessage

type unexpectedMessage struct{}

// DescribableMessage is a message that can provide its own description.
//
// Deprecated: All messages are now describable.
type DescribableMessage interface {
Message
}

// DescribeMessage returns a human-readable description of m.
//
// Deprecated: use [Message.MessageDescription] directly.
func DescribeMessage(m Message) string {
return m.MessageDescription()
}

// ValidateableMessage is a message that provides its own validation logic.
//
// Deprecated: All messages are now validateable.
type ValidateableMessage interface {
Message
}

// ValidateMessage returns an error if m is invalid.
//
// Deprecated: Use [Message.Validate] directly.
func ValidateMessage(m Message) error {
if m == nil {
return errors.New("message must not be nil")
}
return m.Validate()
}
45 changes: 0 additions & 45 deletions message_test.go

This file was deleted.

27 changes: 0 additions & 27 deletions process.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,33 +119,6 @@ type ProcessConfigurer interface {
// Process handlers support the HandlesEvent(), ExecutesCommand() and
// SchedulesTimeout() route types.
Routes(...ProcessRoute)

// ConsumesEventType configures the engine to route events of a specific
// type to the handler.
//
// The event SHOULD be the zero-value of its type; the engine uses the type
// information, but not the value itself.
//
// Deprecated: Use ProcessConfigurer.Routes() instead.
ConsumesEventType(Event)

// ProducesCommandType configures the engine to use the handler as the
// source of events of a specific type.
//
// The command SHOULD be the zero-value of its type; the engine uses the
// type information, but not the value itself.
//
// Deprecated: Use ProcessConfigurer.Routes() instead.
ProducesCommandType(Command)

// SchedulesTimeoutType configures the engine to allow this handler to
// schedule timeouts of a specific type.
//
// The timeout SHOULD be the zero-value of its type; the engine uses the
// type information, but not the value itself.
//
// Deprecated: Use ProcessConfigurer.Routes() instead.
SchedulesTimeoutType(Timeout)
}

// ProcessEventScope performs engine operations within the context of a call
Expand Down
20 changes: 6 additions & 14 deletions projection.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,6 @@ type ProjectionConfigurer interface {
//
// The default policy is UnicastProjectionDeliveryPolicy.
DeliveryPolicy(ProjectionDeliveryPolicy)

// ConsumesEventType configures the engine to route events of a specific
// type to the handler.
//
// The event SHOULD be the zero-value of its type; the engine uses the type
// information, but not the value itself.
//
// Deprecated: Use ProjectionConfigurer.Routes() instead.
ConsumesEventType(Event)
}

// ProjectionEventScope performs engine operations within the context of a call
Expand Down Expand Up @@ -173,13 +164,14 @@ func (NoCompactBehavior) Compact(ctx context.Context, s ProjectionCompactScope)
}

type (
// A ProjectionDeliveryPolicy describes how to deliver events to a projection
// message handler on engines that support concurrent or distributed execution
// of a single Dogma application.
// A ProjectionDeliveryPolicy describes how to deliver events to a
// projection message handler on engines that support concurrent or
// distributed execution of a single Dogma application.
ProjectionDeliveryPolicy interface{ isProjectionDeliveryPolicy() }

// UnicastProjectionDeliveryPolicy is the default [ProjectionDeliveryPolicy]. It
// delivers each event to a single instance of the application.
// UnicastProjectionDeliveryPolicy is the default
// [ProjectionDeliveryPolicy]. It delivers each event to a single instance
// of the application.
UnicastProjectionDeliveryPolicy struct{}

// BroadcastProjectionDeliveryPolicy is a [ProjectionDeliveryPolicy] that
Expand Down

0 comments on commit 9c123a0

Please sign in to comment.