Loading documentation...
Loading documentation...
Loading documentation...
Complete API documentation for the bus package.
Import Path: github.com/kolosys/nova/bus
Config configures the EventBus
// Create a new Config
config := Config{
WorkerPool: &/* value */{},
DefaultBufferSize: 42,
DefaultPartitions: 42,
DefaultDeliveryMode: DeliveryMode{},
MetricsCollector: /* value */,
EventValidator: /* value */,
Name: "example",
}type Config struct {
WorkerPool *workerpool.Pool
DefaultBufferSize int
DefaultPartitions int
DefaultDeliveryMode DeliveryMode
MetricsCollector shared.MetricsCollector
EventValidator shared.EventValidator
Name string
}| Field | Type | Description |
|---|---|---|
| WorkerPool | *workerpool.Pool | WorkerPool for async event processing (required) |
| DefaultBufferSize | int | DefaultBufferSize sets default buffer size for topics |
| DefaultPartitions | int | DefaultPartitions sets default number of partitions |
| DefaultDeliveryMode | DeliveryMode | DefaultDeliveryMode sets default delivery mode |
| MetricsCollector | shared.MetricsCollector | MetricsCollector for observability (optional) |
| EventValidator | shared.EventValidator | EventValidator validates events before processing (optional) |
| Name | string | Name identifies this bus instance |
DeliveryMode defines the delivery guarantees for events
// Example usage of DeliveryMode
var value DeliveryMode
// Initialize with appropriate valuetype DeliveryMode intString returns the string representation of DeliveryMode
func (DeliveryMode) String() stringParameters: None
Returns:
EventBus defines the interface for topic-based event routing
// Example implementation of EventBus
type MyEventBus struct {
// Add your fields here
}
func (m MyEventBus) Publish(param1 context.Context, param2 string, param3 shared.Event) error {
// Implement your logic here
return
}
func (m MyEventBus) Subscribe(param1 string, param2 shared.Listener) shared.Subscription {
// Implement your logic here
return
}
func (m MyEventBus) SubscribePattern(param1 string, param2 shared.Listener) shared.Subscription {
// Implement your logic here
return
}
func (m MyEventBus) CreateTopic(param1 string, param2 TopicConfig) error {
// Implement your logic here
return
}
func (m MyEventBus) DeleteTopic(param1 string) error {
// Implement your logic here
return
}
func (m MyEventBus) Topics() []string {
// Implement your logic here
return
}
func (m MyEventBus) Shutdown(param1 context.Context) error {
// Implement your logic here
return
}
func (m MyEventBus) Stats() Stats {
// Implement your logic here
return
}
type EventBus interface {
Publish(ctx context.Context, topic string, event shared.Event) error
Subscribe(topic string, listener shared.Listener) shared.Subscription
SubscribePattern(pattern string, listener shared.Listener) shared.Subscription
CreateTopic(topic string, config TopicConfig) error
DeleteTopic(topic string) error
Topics() []string
Shutdown(ctx context.Context) error
Stats() Stats
}| Method | Description |
|---|
New creates a new EventBus
func New(config Config) EventBusParameters:
config (Config)Returns:
Stats provides bus statistics
// Create a new Stats
stats := Stats{
EventsPublished: 42,
EventsProcessed: 42,
ActiveTopics: 42,
ActiveSubscribers: 42,
FailedEvents: 42,
QueuedEvents: 42,
}type Stats struct {
EventsPublished int64
EventsProcessed int64
ActiveTopics int64
ActiveSubscribers int64
FailedEvents int64
QueuedEvents int64
}| Field | Type | Description |
|---|---|---|
| EventsPublished | int64 | |
| EventsProcessed | int64 | |
| ActiveTopics | int64 | |
| ActiveSubscribers | int64 | |
| FailedEvents | int64 | |
| QueuedEvents | int64 |
TopicConfig configures a topic
// Create a new TopicConfig
topicconfig := TopicConfig{
BufferSize: 42,
Partitions: 42,
Retention: /* value */,
DeliveryMode: DeliveryMode{},
OrderingKey: /* value */,
MaxConcurrency: 42,
}type TopicConfig struct {
BufferSize int
Partitions int
Retention time.Duration
DeliveryMode DeliveryMode
OrderingKey func(shared.Event) string
MaxConcurrency int
}| Field | Type | Description |
|---|---|---|
| BufferSize | int | BufferSize sets the buffer size for this topic |
| Partitions | int | Partitions sets the number of partitions for parallel processing |
| Retention | time.Duration | Retention sets how long events are retained |
| DeliveryMode | DeliveryMode | DeliveryMode sets the delivery guarantees |
| OrderingKey | func(shared.Event) string | OrderingKey function to determine partition for event ordering |
| MaxConcurrency | int | MaxConcurrency limits concurrent processing per partition |
DefaultTopicConfig returns a default topic configuration
func DefaultTopicConfig() TopicConfigParameters: None
Returns:
Complete API documentation for the bus package.
Import Path: github.com/kolosys/nova/bus
Config configures the EventBus
// Create a new Config
config := Config{
WorkerPool: &/* value */{},
DefaultBufferSize: 42,
DefaultPartitions: 42,
DefaultDeliveryMode: DeliveryMode{},
MetricsCollector: /* value */,
EventValidator: /* value */,
Name: "example",
}type Config struct {
WorkerPool *workerpool.Pool
DefaultBufferSize int
DefaultPartitions int
DefaultDeliveryMode DeliveryMode
MetricsCollector shared.MetricsCollector
EventValidator shared.EventValidator
Name string
}| Field | Type | Description |
|---|---|---|
| WorkerPool | *workerpool.Pool | WorkerPool for async event processing (required) |
| DefaultBufferSize | int | DefaultBufferSize sets default buffer size for topics |
| DefaultPartitions | int | DefaultPartitions sets default number of partitions |
| DefaultDeliveryMode | DeliveryMode | DefaultDeliveryMode sets default delivery mode |
| MetricsCollector | shared.MetricsCollector | MetricsCollector for observability (optional) |
| EventValidator | shared.EventValidator | EventValidator validates events before processing (optional) |
| Name | string | Name identifies this bus instance |
DeliveryMode defines the delivery guarantees for events
// Example usage of DeliveryMode
var value DeliveryMode
// Initialize with appropriate valuetype DeliveryMode intString returns the string representation of DeliveryMode
func (DeliveryMode) String() stringParameters: None
Returns:
EventBus defines the interface for topic-based event routing
// Example implementation of EventBus
type MyEventBus struct {
// Add your fields here
}
func (m MyEventBus) Publish(param1 context.Context, param2 string, param3 shared.Event) error {
// Implement your logic here
return
}
func (m MyEventBus) Subscribe(param1 string, param2 shared.Listener) shared.Subscription {
// Implement your logic here
return
}
func (m MyEventBus) SubscribePattern(param1 string, param2 shared.Listener) shared.Subscription {
// Implement your logic here
return
}
func (m MyEventBus) CreateTopic(param1 string, param2 TopicConfig) error {
// Implement your logic here
return
}
func (m MyEventBus) DeleteTopic(param1 string) error {
// Implement your logic here
return
}
func (m MyEventBus) Topics() []string {
// Implement your logic here
return
}
func (m MyEventBus) Shutdown(param1 context.Context) error {
// Implement your logic here
return
}
func (m MyEventBus) Stats() Stats {
// Implement your logic here
return
}
type EventBus interface {
Publish(ctx context.Context, topic string, event shared.Event) error
Subscribe(topic string, listener shared.Listener) shared.Subscription
SubscribePattern(pattern string, listener shared.Listener) shared.Subscription
CreateTopic(topic string, config TopicConfig) error
DeleteTopic(topic string) error
Topics() []string
Shutdown(ctx context.Context) error
Stats() Stats
}| Method | Description |
|---|
New creates a new EventBus
func New(config Config) EventBusParameters:
config (Config)Returns:
Stats provides bus statistics
// Create a new Stats
stats := Stats{
EventsPublished: 42,
EventsProcessed: 42,
ActiveTopics: 42,
ActiveSubscribers: 42,
FailedEvents: 42,
QueuedEvents: 42,
}type Stats struct {
EventsPublished int64
EventsProcessed int64
ActiveTopics int64
ActiveSubscribers int64
FailedEvents int64
QueuedEvents int64
}| Field | Type | Description |
|---|---|---|
| EventsPublished | int64 | |
| EventsProcessed | int64 | |
| ActiveTopics | int64 | |
| ActiveSubscribers | int64 | |
| FailedEvents | int64 | |
| QueuedEvents | int64 |
TopicConfig configures a topic
// Create a new TopicConfig
topicconfig := TopicConfig{
BufferSize: 42,
Partitions: 42,
Retention: /* value */,
DeliveryMode: DeliveryMode{},
OrderingKey: /* value */,
MaxConcurrency: 42,
}type TopicConfig struct {
BufferSize int
Partitions int
Retention time.Duration
DeliveryMode DeliveryMode
OrderingKey func(shared.Event) string
MaxConcurrency int
}| Field | Type | Description |
|---|---|---|
| BufferSize | int | BufferSize sets the buffer size for this topic |
| Partitions | int | Partitions sets the number of partitions for parallel processing |
| Retention | time.Duration | Retention sets how long events are retained |
| DeliveryMode | DeliveryMode | DeliveryMode sets the delivery guarantees |
| OrderingKey | func(shared.Event) string | OrderingKey function to determine partition for event ordering |
| MaxConcurrency | int | MaxConcurrency limits concurrent processing per partition |
DefaultTopicConfig returns a default topic configuration
func DefaultTopicConfig() TopicConfigParameters: None
Returns:
// Create a new Config
config := Config{
WorkerPool: &/* value */{},
DefaultBufferSize: 42,
DefaultPartitions: 42,
DefaultDeliveryMode: DeliveryMode{},
MetricsCollector: /* value */,
EventValidator: /* value */,
Name: "example",
}type Config struct {
WorkerPool *workerpool.Pool
DefaultBufferSize int
DefaultPartitions int
DefaultDeliveryMode DeliveryMode
MetricsCollector shared.MetricsCollector
EventValidator shared.EventValidator
Name string
}// Example usage of DeliveryMode
var value DeliveryMode
// Initialize with appropriate valuetype DeliveryMode intfunc (DeliveryMode) String() string// Example implementation of EventBus
type MyEventBus struct {
// Add your fields here
}
func (m MyEventBus) Publish(param1 context.Context, param2 string, param3 shared.Event) error {
// Implement your logic here
return
}
func (m MyEventBus) Subscribe(param1 string, param2 shared.Listener) shared.Subscription {
// Implement your logic here
return
}
func (m MyEventBus) SubscribePattern(param1 string, param2 shared.Listener) shared.Subscription {
// Implement your logic here
return
}
func (m MyEventBus) CreateTopic(param1 string, param2 TopicConfig) error {
// Implement your logic here
return
}
func (m MyEventBus) DeleteTopic(param1 string) error {
// Implement your logic here
return
}
func (m MyEventBus) Topics() []string {
// Implement your logic here
return
}
func (m MyEventBus) Shutdown(param1 context.Context) error {
// Implement your logic here
return
}
func (m MyEventBus) Stats() Stats {
// Implement your logic here
return
}
type EventBus interface {
Publish(ctx context.Context, topic string, event shared.Event) error
Subscribe(topic string, listener shared.Listener) shared.Subscription
SubscribePattern(pattern string, listener shared.Listener) shared.Subscription
CreateTopic(topic string, config TopicConfig) error
DeleteTopic(topic string) error
Topics() []string
Shutdown(ctx context.Context) error
Stats() Stats
}func New(config Config) EventBus// Create a new Stats
stats := Stats{
EventsPublished: 42,
EventsProcessed: 42,
ActiveTopics: 42,
ActiveSubscribers: 42,
FailedEvents: 42,
QueuedEvents: 42,
}type Stats struct {
EventsPublished int64
EventsProcessed int64
ActiveTopics int64
ActiveSubscribers int64
FailedEvents int64
QueuedEvents int64
}// Create a new TopicConfig
topicconfig := TopicConfig{
BufferSize: 42,
Partitions: 42,
Retention: /* value */,
DeliveryMode: DeliveryMode{},
OrderingKey: /* value */,
MaxConcurrency: 42,
}type TopicConfig struct {
BufferSize int
Partitions int
Retention time.Duration
DeliveryMode DeliveryMode
OrderingKey func(shared.Event) string
MaxConcurrency int
}func DefaultTopicConfig() TopicConfig// Create a new Config
config := Config{
WorkerPool: &/* value */{},
DefaultBufferSize: 42,
DefaultPartitions: 42,
DefaultDeliveryMode: DeliveryMode{},
MetricsCollector: /* value */,
EventValidator: /* value */,
Name: "example",
}type Config struct {
WorkerPool *workerpool.Pool
DefaultBufferSize int
DefaultPartitions int
DefaultDeliveryMode DeliveryMode
MetricsCollector shared.MetricsCollector
EventValidator shared.EventValidator
Name string
}// Example usage of DeliveryMode
var value DeliveryMode
// Initialize with appropriate valuetype DeliveryMode intfunc (DeliveryMode) String() string// Example implementation of EventBus
type MyEventBus struct {
// Add your fields here
}
func (m MyEventBus) Publish(param1 context.Context, param2 string, param3 shared.Event) error {
// Implement your logic here
return
}
func (m MyEventBus) Subscribe(param1 string, param2 shared.Listener) shared.Subscription {
// Implement your logic here
return
}
func (m MyEventBus) SubscribePattern(param1 string, param2 shared.Listener) shared.Subscription {
// Implement your logic here
return
}
func (m MyEventBus) CreateTopic(param1 string, param2 TopicConfig) error {
// Implement your logic here
return
}
func (m MyEventBus) DeleteTopic(param1 string) error {
// Implement your logic here
return
}
func (m MyEventBus) Topics() []string {
// Implement your logic here
return
}
func (m MyEventBus) Shutdown(param1 context.Context) error {
// Implement your logic here
return
}
func (m MyEventBus) Stats() Stats {
// Implement your logic here
return
}
type EventBus interface {
Publish(ctx context.Context, topic string, event shared.Event) error
Subscribe(topic string, listener shared.Listener) shared.Subscription
SubscribePattern(pattern string, listener shared.Listener) shared.Subscription
CreateTopic(topic string, config TopicConfig) error
DeleteTopic(topic string) error
Topics() []string
Shutdown(ctx context.Context) error
Stats() Stats
}func New(config Config) EventBus// Create a new Stats
stats := Stats{
EventsPublished: 42,
EventsProcessed: 42,
ActiveTopics: 42,
ActiveSubscribers: 42,
FailedEvents: 42,
QueuedEvents: 42,
}type Stats struct {
EventsPublished int64
EventsProcessed int64
ActiveTopics int64
ActiveSubscribers int64
FailedEvents int64
QueuedEvents int64
}// Create a new TopicConfig
topicconfig := TopicConfig{
BufferSize: 42,
Partitions: 42,
Retention: /* value */,
DeliveryMode: DeliveryMode{},
OrderingKey: /* value */,
MaxConcurrency: 42,
}type TopicConfig struct {
BufferSize int
Partitions int
Retention time.Duration
DeliveryMode DeliveryMode
OrderingKey func(shared.Event) string
MaxConcurrency int
}func DefaultTopicConfig() TopicConfig