Skip to content

Commit

Permalink
Added topic endpoint example
Browse files Browse the repository at this point in the history
  • Loading branch information
bczoma committed Feb 9, 2024
1 parent 71feafa commit d963c29
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ Refer to the following configuration examples:
- [Queue with topic subscriptions](examples/queue-with-topic-subscriptions)
- [Queue with exposed JNDI](examples/queue-with-jndi)
- [Queue template](examples/queue-template)
- Topic endpoint
- Topic endpoint with exposed JNDI
- Topic endpoint template
- [Topic endpoint](examples/topic-endpoint)
- [Topic endpoint with exposed JNDI](examples/topic-endpoint-with-jndi)
- [Topic endpoint template](examples/topic-endpoint-template)

## Module use recommendations

Expand Down
2 changes: 1 addition & 1 deletion examples/exclusive-queue/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module "exclusive_queue" {
endpoint_type = "queue"
endpoint_name = "testEQ"

# permission "consume" enables messaging a messaging client to connect, read and consume messages to/from the queue
# permission "consume" enables a messaging client to connect, read and consume messages to/from the queue
permission = "consume"

# access_type "exclusive" is the default queue access type. While it has been specified here for clarity, it is not strictly required.
Expand Down
2 changes: 1 addition & 1 deletion examples/non-exclusive-queue/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module "non_exclusive_queue" {
endpoint_type = "queue"
endpoint_name = "testNEQ"

# permission "consume" enables messaging a messaging client to connect, read and consume messages to/from the queue
# permission "consume" enables a messaging client to connect, read and consume messages to/from the queue
permission = "consume"

# access_type "exclusive" is the default queue access type. This variable needs to be specified here to configure a non-exclusive queue
Expand Down
2 changes: 1 addition & 1 deletion examples/partitioned-queue/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module "partitioned_queue" {
endpoint_type = "queue"
endpoint_name = "testPQ"

# permission "consume" enables messaging a messaging client to connect, read and consume messages to/from the queue
# permission "consume" enables a messaging client to connect, read and consume messages to/from the queue
permission = "consume"

# access_type "exclusive" is the default queue access type. This variable needs to be specified here to configure a non-exclusive queue
Expand Down
2 changes: 1 addition & 1 deletion examples/queue-template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Configuration in this directory creates a [queue template](https://docs.solace.c

This example specifies an optional attribute `respect_ttl_enabled` of the queue template for demo purposes.

Optional module input variables have the same name as the attributes of the underlying provider resource. If omitted then the default for the related resource attribute will be configured on the broker. For attributes and defaults, refer to the [documentation of "solacebroker_msg_vpn_queue"](https://registry.terraform.io/providers/SolaceProducts/solacebroker/latest/docs/resources/msg_vpn_queue#optional).
Optional module input variables have the same name as the attributes of the underlying provider resource. If omitted then the default for the related resource attribute will be configured on the broker. For attributes and defaults, refer to the [documentation of "solacebroker_msg_vpn_queue_template"](https://registry.terraform.io/providers/SolaceProducts/solacebroker/latest/docs/resources/msg_vpn_queue_template#optional).

### Output

Expand Down
2 changes: 1 addition & 1 deletion examples/queue-template/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module "queue_template" {
endpoint_type = "queue_template"
endpoint_name = "testQT"

# permission "consume" enables messaging a messaging client to connect, read and consume messages to/from the queue
# permission "consume" enables a messaging client to connect, read and consume messages to/from the queue
permission = "consume"

# example optional config for the queue template
Expand Down
2 changes: 1 addition & 1 deletion examples/queue-with-jndi/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module "queue_with_jndi" {
endpoint_type = "queue"
endpoint_name = "testJQ"

# permission "consume" enables messaging a messaging client to connect, read and consume messages to/from the queue
# permission "consume" enables a messaging client to connect, read and consume messages to/from the queue
permission = "consume"

# if the "jndi_queue_name" input variable is defined then the queue will be exposed to JNDI under this name
Expand Down
2 changes: 1 addition & 1 deletion examples/queue-with-topic-subscriptions/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module "queue_with_topic_subscriptions" {
endpoint_type = "queue"
endpoint_name = "testQS"

# permission "consume" enables messaging a messaging client to connect, read and consume messages to/from the queue
# permission "consume" enables a messaging client to connect, read and consume messages to/from the queue
permission = "consume"

# this will add the listed subscriptions to the queue
Expand Down
59 changes: 59 additions & 0 deletions examples/topic-endpoint/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Topic Endpoint Example

Configuration in this directory creates a [topic endpoint](https://docs.solace.com/Get-Started/topic-endpoints-queues.htm) on the PubSub+ event broker leveraging the Queue Endpoint Terraform module.

Important: The topic subscription that a topic endpoint will spool messages for is not specified when a topic endpoint is provisioned. For additional details refer to the [PubSub+ documentation](https://docs.solace.com/Messaging/Guaranteed-Msg/Configuring-DTEs.htm).

## Module Configuration in the Example

### Mandatory Inputs

* `msg_vpn_name` - set to `default` in the example
* `endpoint_type` - set to `topic_endpoint`
* `endpoint_name` - set to `testEQ` in the example
* `permission` - set to `consume` in the example to enable the receiver app to remove consumed messages from the topic endpoint

### Optional Inputs

Note that the `access_type` module input variable defines if a topic endpoint is "exclusive" or "non-exclusive". The default is "exclusive".

Optional module input variables have the same name as the attributes of the underlying provider resource. If omitted then the default for the related resource attribute will be configured on the broker. For attributes and defaults, refer to the [documentation of "solacebroker_msg_vpn_topic_endpoint"](https://registry.terraform.io/providers/SolaceProducts/solacebroker/latest/docs/resources/msg_vpn_topic_endpoint#optional).

### Output

The module `provisioned_topic endpoint` output refers to the created topic endpoint.

## Created resources

This example will create following resources:

* `solacebroker_msg_vpn_topic endpoint`

## Running the Example

### Access to a PubSub+ broker

If you don't already have access to a broker, refer to the [Developers page](https://www.solace.dev/) for options to get started.

### Adjust Provider Configuration

Adjust the [provider parameters](https://registry.terraform.io/providers/SolaceProducts/solacebroker/latest/docs#schema) in `main.tf` according to your broker. The example configuration shows settings for a local broker running in Docker.

### Create the resource

Hint: You can verify configuration changes on the broker, before and after, using the [PubSub+ Broker Manager Web UI](https://docs.solace.com/Admin/Broker-Manager/PubSub-Manager-Overview.htm)

Execute from this folder:

```bash
$ terraform init
$ terraform plan
$ terraform apply
```

Run `terraform destroy` to clean up created resources when no longer needed.

## Additional Documentation

Refer to the [Configuring Topic Endpoints](https://docs.solace.com/Messaging/Guaranteed-Msg/Configuring-DTEs.htm) section in the PubSub+ documentation.

30 changes: 30 additions & 0 deletions examples/topic-endpoint/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
provider "solacebroker" {
username = "admin"
password = "admin"
url = "http://localhost:8080"
}

module "topic_endpoint" {
# update with the module location
source = "../.."

msg_vpn_name = "default"
endpoint_type = "topic_endpoint"
endpoint_name = "testTE"

# permission "consume" enables a messaging client to connect, read and consume messages to/from the topic endpoint
permission = "consume"

# access_type "exclusive" is the default topic endpoint access type. While it has been specified here for clarity, it is not strictly required.
access_type = "exclusive"

# ingress and egress are enabled by default in the module, no need to enable here
# ingress_enabled = true
# egress_enabled = true
}

output "provisioned_topic_endpoint" {
value = module.topic_endpoint.topic_endpoint
description = "The provisioned topic_endpoint resource"
}

9 changes: 9 additions & 0 deletions examples/topic-endpoint/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Terraform configuration

terraform {
required_providers {
solacebroker = {
source = "registry.terraform.io/solaceproducts/solacebroker"
}
}
}

0 comments on commit d963c29

Please sign in to comment.