Documentation ¶
Overview ¶
Package ehr is a generated GoMock package.
Package ehr is a generated GoMock package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BundleSet ¶
type BundleSet struct { Id string Bundles []fhir.Bundle `json:"bundles"` // contains filtered or unexported fields }
BundleSet represents a set of FHIR bundles associated with a task.
type DebugClient ¶
type DebugClient struct { }
func (*DebugClient) SubmitMessage ¶
SubmitMessage writes a message to a file in the /tmp directory. The filename is derived from the key by replacing colons with underscores and appending the .json extension.
Parameters:
- key: The key of the message, used to generate the filename.
- value: The value of the message, written to the file.
Returns:
- error: An error if the file could not be written.
type KafkaClient ¶
KafkaClient is an interface that defines the method for submitting messages. Implementations of this interface should provide the logic for submitting messages to a Kafka topic or an alternative storage.
Methods:
- SubmitMessage: Submits a message with the given key and value.
Parameters:
- ctx: The context for the message submission, used for cancellation and timeouts.
- key: The key of the message to be submitted.
- value: The value of the message to be submitted.
Returns:
- error: An error if the message could not be submitted.
func CreateSaslClient ¶
func CreateSaslClient(config KafkaConfig, kafkaClient KafkaClient) (KafkaClient, error)
CreateSaslClient creates a new Kafka client with SASL authentication based on the provided KafkaConfig. It supports the PLAIN mechanism for SASL authentication.
Parameters:
- config: KafkaConfig containing the configuration for the Kafka client.
- kafkaClient: KafkaClient interface to be initialized.
Returns:
- KafkaClient: An implementation of the KafkaClient interface.
- error: An error if the Kafka client could not be created or if the mechanism is unsupported.
func NewClient ¶
func NewClient(config KafkaConfig) (KafkaClient, error)
NewClient creates a new KafkaClient based on the provided KafkaConfig. If Kafka is enabled in the configuration, it initializes a Kafka producer and sets up a delivery report handler for produced messages. If Kafka is not enabled, it returns a DebugClient which writes messages to a file.
Parameters:
- config: KafkaConfig containing the configuration for the Kafka client.
Returns:
- KafkaClient: An implementation of the KafkaClient interface.
- error: An error if the Kafka producer could not be created.
type KafkaClientImpl ¶
type KafkaClientImpl struct {
// contains filtered or unexported fields
}
KafkaClientImpl is an implementation of the KafkaClient interface. It holds the Kafka topic and producer used to submit messages.
func (*KafkaClientImpl) SubmitMessage ¶
SubmitMessage submits a message to the Kafka topic associated with the KafkaClientImpl. It produces a message with the given key and value to the Kafka producer.
Parameters:
- key: The key of the message to be submitted.
- value: The value of the message to be submitted.
Returns:
- error: An error if the message could not be produced.
type KafkaConfig ¶
type KafkaConfig struct { Enabled bool `koanf:"enabled" default:"false" description:"This enables the Kafka client."` DebugOnly bool `` /* 161-byte string literal not displayed */ Topic string `koanf:"topic"` Endpoint string `koanf:"endpoint"` Sasl SaslConfig `koanf:"sasl"` Security SecurityConfig `koanf:"security"` }
KafkaConfig holds the configuration settings for connecting to a Kafka broker. It includes options to enable Kafka, specify the topic, endpoint, and connection string.
Fields:
- Enabled: A boolean indicating whether Kafka is enabled.
- Topic: The Kafka topic to which messages will be sent.
- Endpoint: The Kafka broker endpoint.
- ConnectionString: The connection string used for authentication.
type MockKafkaClient ¶
type MockKafkaClient struct {
// contains filtered or unexported fields
}
MockKafkaClient is a mock of KafkaClient interface.
func NewMockKafkaClient ¶
func NewMockKafkaClient(ctrl *gomock.Controller) *MockKafkaClient
NewMockKafkaClient creates a new mock instance.
func (*MockKafkaClient) EXPECT ¶
func (m *MockKafkaClient) EXPECT() *MockKafkaClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockKafkaClient) SubmitMessage ¶
func (m *MockKafkaClient) SubmitMessage(ctx context.Context, key, value string) error
SubmitMessage mocks base method.
type MockKafkaClientMockRecorder ¶
type MockKafkaClientMockRecorder struct {
// contains filtered or unexported fields
}
MockKafkaClientMockRecorder is the mock recorder for MockKafkaClient.
func (*MockKafkaClientMockRecorder) SubmitMessage ¶
func (mr *MockKafkaClientMockRecorder) SubmitMessage(ctx, key, value any) *gomock.Call
SubmitMessage indicates an expected call of SubmitMessage.
type MockNotifier ¶
type MockNotifier struct {
// contains filtered or unexported fields
}
MockNotifier is a mock of Notifier interface.
func NewMockNotifier ¶
func NewMockNotifier(ctrl *gomock.Controller) *MockNotifier
NewMockNotifier creates a new mock instance.
func (*MockNotifier) EXPECT ¶
func (m *MockNotifier) EXPECT() *MockNotifierMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockNotifier) NotifyTaskAccepted ¶
func (m *MockNotifier) NotifyTaskAccepted(ctx context.Context, cpsClient fhirclient.Client, task *fhir.Task) error
NotifyTaskAccepted mocks base method.
type MockNotifierMockRecorder ¶
type MockNotifierMockRecorder struct {
// contains filtered or unexported fields
}
MockNotifierMockRecorder is the mock recorder for MockNotifier.
func (*MockNotifierMockRecorder) NotifyTaskAccepted ¶
func (mr *MockNotifierMockRecorder) NotifyTaskAccepted(ctx, cpsClient, task any) *gomock.Call
NotifyTaskAccepted indicates an expected call of NotifyTaskAccepted.
type Notifier ¶
type Notifier interface {
NotifyTaskAccepted(ctx context.Context, cpsClient fhirclient.Client, task *fhir.Task) error
}
func NewNotifier ¶
func NewNotifier(kafkaClient KafkaClient) Notifier
type SaslConfig ¶
type SaslConfig struct { // Mechanism contains the SASL mechanism to use for authentication (e.g., PLAIN). Mechanism string `koanf:"mechanism" default:"PLAIN"` Username string `koanf:"username" default:"$ConnectionString"` Password string `koanf:"password"` }
SaslConfig holds the configuration settings for SASL authentication. It includes the mechanism, username, and password required for authentication
type SecurityConfig ¶
type SecurityConfig struct {
Protocol string `koanf:"protocol" default:"SASL_PLAINTEXT"`
}