From 047aa28ea3d4eee8b04b89d167e6c6c81abec55c Mon Sep 17 00:00:00 2001 From: Balazs Czoma Date: Fri, 9 Feb 2024 14:54:11 -0500 Subject: [PATCH] Added DTE to JNDI example --- examples/queue-with-jndi/main.tf | 2 +- examples/topic-endpoint-with-jndi/README.md | 62 +++++++++++++++++++ examples/topic-endpoint-with-jndi/main.tf | 35 +++++++++++ .../topic-endpoint-with-jndi/providers.tf | 9 +++ examples/topic-endpoint/README.md | 2 +- 5 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 examples/topic-endpoint-with-jndi/README.md create mode 100644 examples/topic-endpoint-with-jndi/main.tf create mode 100644 examples/topic-endpoint-with-jndi/providers.tf diff --git a/examples/queue-with-jndi/main.tf b/examples/queue-with-jndi/main.tf index d7acadb..290b255 100644 --- a/examples/queue-with-jndi/main.tf +++ b/examples/queue-with-jndi/main.tf @@ -16,7 +16,7 @@ module "queue_with_jndi" { permission = "consume" # if the "jndi_queue_name" input variable is defined then the queue will be exposed to JNDI under this name - jndi_queue_name = "/jndi/testJQ" + jndi_queue_name = "/jndi/queue/testJQ" # ingress and egress are enabled by default in the module, no need to enable here # ingress_enabled = true diff --git a/examples/topic-endpoint-with-jndi/README.md b/examples/topic-endpoint-with-jndi/README.md new file mode 100644 index 0000000..61b3d71 --- /dev/null +++ b/examples/topic-endpoint-with-jndi/README.md @@ -0,0 +1,62 @@ +# Topic Endpoint with JNDI Example + +Configuration in this directory creates a [topic endpoint that is also exposed as a JNDI administered object](https://docs.solace.com/API/Solace-JMS-API/Managing-Solace-JNDI-Objects.htm) on the PubSub+ event broker leveraging the Queue Endpoint Terraform module. + +Note that exposing topics as JNDI objects also requires JNDI enabled at the Message VPN level and the configuration of a Connection Factory. The [Service Module](TODO:add link) and the [JNDI Connection Factory Module](TODO:add link) may be used to configure that. This module will not check if they are in place but configuration will fail. + +## 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 `testJT` 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 + +* `jndi_topic_name`: if provided then the topic endpoint will be exposed to JNDI under this name + +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. + +The module `provisioned_jndi_topic endpoint` output refers to the created JNDI topic resource. + +## Created resources + +This example will create following resources: + +* `solacebroker_msg_vpn_topic endpoint` +* `solacebroker_msg_vpn_jndi_topic endpoint` if `jndi_topic_name` has been provided + +## 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. + diff --git a/examples/topic-endpoint-with-jndi/main.tf b/examples/topic-endpoint-with-jndi/main.tf new file mode 100644 index 0000000..98d0012 --- /dev/null +++ b/examples/topic-endpoint-with-jndi/main.tf @@ -0,0 +1,35 @@ +provider "solacebroker" { + username = "admin" + password = "admin" + url = "http://localhost:8080" +} + +module "topic_endpoint_with_jndi" { + # update with the module location + source = "../.." + + msg_vpn_name = "default" + endpoint_type = "topic_endpoint" + endpoint_name = "testJT" + + # permission "consume" enables a messaging client to connect, read and consume messages to/from the topic endpoint + permission = "consume" + + # if the "jndi_topic_name" input variable is defined then the topic endpoint will be exposed to JNDI under this name + jndi_topic_name = "/jndi/topic/testJT" + + # 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_with_jndi.topic_endpoint + description = "The provisioned topic_endpoint resource" +} + +output "provisioned_jndi_topic" { + value = module.topic_endpoint_with_jndi.jndi_topic + description = "The provisioned JNDI topic resource" +} + diff --git a/examples/topic-endpoint-with-jndi/providers.tf b/examples/topic-endpoint-with-jndi/providers.tf new file mode 100644 index 0000000..46c4322 --- /dev/null +++ b/examples/topic-endpoint-with-jndi/providers.tf @@ -0,0 +1,9 @@ +# Terraform configuration + +terraform { + required_providers { + solacebroker = { + source = "registry.terraform.io/solaceproducts/solacebroker" + } + } +} diff --git a/examples/topic-endpoint/README.md b/examples/topic-endpoint/README.md index e235807..ce237dc 100644 --- a/examples/topic-endpoint/README.md +++ b/examples/topic-endpoint/README.md @@ -10,7 +10,7 @@ Important: The topic subscription that a topic endpoint will spool messages for * `msg_vpn_name` - set to `default` in the example * `endpoint_type` - set to `topic_endpoint` -* `endpoint_name` - set to `testEQ` in the example +* `endpoint_name` - set to `testTE` 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