pulsar

package module
v0.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithFunctionsWorker

func WithFunctionsWorker() testcontainers.CustomizeRequestOption

WithFunctionsWorker enables the functions worker, which will override the default pulsar command and add a waiting strategy for the functions worker

func WithPulsarEnv

func WithPulsarEnv(configVar string, configValue string) testcontainers.CustomizeRequestOption

WithPulsarEnv allows to use the native APIs and set each variable with PULSAR_PREFIX_ as prefix.

func WithTransactions

func WithTransactions() testcontainers.CustomizeRequestOption

Types

type Container

type Container struct {
	testcontainers.Container
	LogConsumers []testcontainers.LogConsumer // Deprecated. Use the ContainerRequest instead. Needs to be exported to control the stop from the caller
}

func RunContainer added in v0.20.0

func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*Container, error)

RunContainer creates an instance of the Pulsar container type, being possible to pass a custom request and options The created container will use the following defaults: - image: docker.io/apachepulsar/pulsar:2.10.2 - exposed ports: 6650/tcp, 8080/tcp - waiting strategy: wait for all the following strategies:

  • the Pulsar admin API ("/admin/v2/clusters") to be ready on port 8080/tcp and return the response `["standalone"]`
  • the log message "Successfully updated the policies on namespace public/default"

- command: "/bin/bash -c /pulsar/bin/apply-config-from-env.py /pulsar/conf/standalone.conf && bin/pulsar standalone --no-functions-worker -nss"

Example
// runPulsarContainer {
ctx := context.Background()

pulsarContainer, err := pulsar.RunContainer(ctx,
	testcontainers.WithImage("docker.io/apachepulsar/pulsar:2.10.2"),
)
if err != nil {
	log.Fatalf("failed to start container: %s", err)
}

// Clean up the container
defer func() {
	if err := pulsarContainer.Terminate(ctx); err != nil {
		log.Fatalf("failed to terminate container: %s", err)
	}
}()
// }

state, err := pulsarContainer.State(ctx)
if err != nil {
	log.Fatalf("failed to get container state: %s", err) // nolint:gocritic
}

fmt.Println(state.Running)
Output:

true

func (*Container) BrokerURL

func (c *Container) BrokerURL(ctx context.Context) (string, error)

func (*Container) HTTPServiceURL

func (c *Container) HTTPServiceURL(ctx context.Context) (string, error)

func (*Container) WithLogConsumers deprecated added in v0.20.0

func (c *Container) WithLogConsumers(ctx context.Context, consumer ...testcontainers.LogConsumer)

Deprecated: use the testcontainers.WithLogConsumers functional option instead WithLogConsumers allows to add log consumers to the container. They will be automatically started and they will follow the container logs, but it's a responsibility of the caller to stop them calling StopLogProducer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL