Skip to content

Commit

Permalink
Added topic endpoint template example
Browse files Browse the repository at this point in the history
  • Loading branch information
bczoma committed Feb 9, 2024
1 parent 047aa28 commit 9df4b00
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ This module supports the configuration of one of the followings:

The module also supports exposing a created queue or topic endpoint via JNDI for JMS applications.

Full details are provided in the [Examples](#example).

## Module input variables

### Required
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 @@ -19,7 +19,7 @@ Optional module input variables have the same name as the attributes of the unde

### Output

The module `provisioned_queue_template` output refers to the created queue.
The module `provisioned_queue_template` output refers to the created queue template.

## Created resources

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

# permission "consume" enables a messaging client to connect, read and consume messages to/from the queue
# that has been created from the template
permission = "consume"

# example optional config for the queue template
Expand All @@ -21,6 +22,6 @@ module "queue_template" {

output "provisioned_queue_template" {
value = module.queue_template.queue_template
description = "The provisioned queue template"
description = "The provisioned queue template resource"
}

59 changes: 59 additions & 0 deletions examples/topic-endpoint-template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Topic Endpoint Template Example

Configuration in this directory creates a [topic endpoint template](https://docs.solace.com/Messaging/Guaranteed-Msg/Configuring-Endpoint-Templates.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 template 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 `testTT` in the example
* `permission` - set to `consume` in the example to enable the receiver app to remove consumed messages from the topic endpoint, that has been created from the template

### Optional Inputs

This example specifies an optional attribute `respect_ttl_enabled` of the topic endpoint 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_topic_endpoint_template"](https://registry.terraform.io/providers/SolaceProducts/solacebroker/latest/docs/resources/msg_vpn_topic_endpoint_template#optional).

### Output

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

## Created resources

This example will create following resources:

* `solacebroker_msg_vpn_topic endpoint_template`

## 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.

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

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

msg_vpn_name = "default"
endpoint_type = "topic_endpoint_template"
endpoint_name = "testTT"

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

# example optional config for the queue template
respect_ttl_enabled = true
}

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

9 changes: 9 additions & 0 deletions examples/topic-endpoint-template/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 9df4b00

Please sign in to comment.