Http trigger can not work
bighb69738 opened this issue · comments
Hi all,
I tried to use http titgger, but it can not work.
I used custom simple-filter-xml with app-functions-sdk-go 2.2.0.
And I followed this https://docs.edgexfoundry.org/2.2/microservices/application/Triggers/#http-trigger, but I do not know what is the port.
Designating an HTTP trigger will allow the pipeline to be triggered by a RESTful POST call to http://[host]:[port]/api/v2/trigger/.
Is it the container's port or Command service's port ?
When I tryied to post by http://[host]:{simple-filter-xml's port }/api/v2/trigger, the error response was "connect ECONNREFUSED".
configuration.toml
[Writable]
LogLevel = "INFO"
[Writable.StoreAndForward]
Enabled = false
RetryInterval = "5m"
MaxRetryCount = 10
[Writable.InsecureSecrets]
[Writable.InsecureSecrets.DB]
path = "redisdb"
[Writable.InsecureSecrets.DB.Secrets]
username = ""
password = ""
[Service]
HealthCheckInterval = "10s"
Host = "localhost"
Port = 59780 # Adjust if running multiple examples at the same time to avoid duplicate port conflicts
ServerBindAddr = "" # if blank, uses default Go behavior https://golang.org/pkg/net/#Listen
StartupMsg = "This is a sample Filter/XML Transform Application Service"
RequestTimeout = "30s"
MaxRequestSize = 0
MaxResultCount = 0
[Registry]
Host = "localhost"
Port = 8500
Type = "consul"
# Database is require when Store and Forward is enabled
[Database]
Type = "redisdb"
Host = "localhost"
Port = 6379
Timeout = "30s"
# SecretStore is required when Store and Forward is enabled and running with security
# so Database credentials can be pulled from Vault.
# Note when running in docker from compose file set the following environment variables:
# - SecretStore_Host: edgex-vault
[SecretStore]
Type = "vault"
Host = "localhost"
Port = 8200
Path = "app-simple-filter-xml/"
Protocol = "http"
TokenFile = "/tmp/edgex/secrets/app-simple-filter-xml/secrets-token.json"
RootCaCertPath = ""
ServerName = ""
[SecretStore.Authentication]
AuthType = "X-Vault-Token"
[Clients]
[Clients.core-metadata]
Protocol = "http"
Host = "localhost"
Port = 59881
# Choose either the http trigger or edgex-messagebus trigger
[Trigger]
Type="http"
#[Trigger]
#Type="edgex-messagebus"
# [Trigger.EdgexMessageBus]
# Type = "redis"
# [Trigger.EdgexMessageBus.SubscribeHost]
# Host = "localhost"
# Port = 6379
# Protocol = "redis"
# SubscribeTopics="edgex/events/#"
# [Trigger.EdgexMessageBus.PublishHost]
# Host = "localhost"
# Port = 6379
# Protocol = "redis"
# PublishTopic="example"
# App Service specifc simple settings
# Great for single string settings. For more complex structured custom configuration
# See https://docs.edgexfoundry.org/2.0/microservices/application/AdvancedTopics/#custom-configuration
[ApplicationSettings]
DeviceNames = "AX-3D"
You have to replace [host]:{simple-filter-xml's port }
with the actual values. Like localhost:59780
The port is in the configuration you posted.
[Service]
HealthCheckInterval = "10s"
Host = "localhost"
Port = 59780 # Adjust if running multiple examples at the same time to avoid duplicate port conflicts
ServerBindAddr = "" # if blank, uses default Go behavior https://golang.org/pkg/net/#Listen
StartupMsg = "This is a sample Filter/XML Transform Application Service"
RequestTimeout = "30s"
MaxRequestSize = 0
MaxResultCount = 0
@lenny-intel
I modified the Service port and it can work now.
Thank you!