Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synapse_handler configuration is not working as mentioned in the documentation #1010

Open
chanikag opened this issue Oct 8, 2024 · 2 comments

Comments

@chanikag
Copy link
Contributor

chanikag commented Oct 8, 2024

Description

Below is the configuration you have to add to enable a synapse handler

[synapse_handlers.<custom_handler_name>]
 enabled=true
 class="org.wso2.carbon.apimgt.gateway.handlers.<Custom_Handler_Class>"

Related PRs:

wso2/docs-apim#8214
wso2/docs-apim#8220
wso2/docs-apim#8221
wso2/docs-apim#8222
wso2/docs-apim#8223

Steps to reproduce

The steps to be followed to reproduce the issue.

Affected version(s)

The versions that are affected by the issue.

Related issue(s) (optional)

Any related issues such as sub tasks and issues reported in other repositories (e.g., component repositories), similar problems, etc.

Suggested label(s) (optional)

Optional comma-separated list of suggested labels. Non committers can’t assign labels to issues, and thereby, this will help issue creators who are not a committer to suggest possible labels.

Suggested assignee(s) (optional)

Optional comma-separated list of suggested team members who should attend the issue. Non committers can’t assign issues to assignees, and thereby, this will help issue creators who are not a committer to suggest possible assignees.

@SanojPunchihewa
Copy link
Contributor

AFAIK, we need to use the following format added via #258 to configure a Synapse handler in MI

[[synapse_handlers]]
name = "<handlerName>"
class = "<packageName>.<handlerName>"

@gspadotto
Copy link

Hi, I think @SanojPunchihewa is almost right (the suffix of the "class" entry, after the last full stop is the CLASS name, not the HANDLER name).

I would personally keep the current format to avoid refactorings for deployment.toml files that define SynapseHandlers.

With the current format, the only way of disabling an handler is by commenting it out in deployment.toml.

If you want to enable/disable a specific handler without commenting it out, then you might add the "enabled" boolean property with an explicit value of "false" (the default being "true"), like this:

[[synapse_handlers]]
name="<handlerName>"
class="<packageName>.<handlerClassName>"
enabled=false

It would also be nice to know/define what the triggering order of multiple handlers is.

Are they triggered in the same order in which they are defined in the deployment.toml file (thus SynapseHandlers are kept in a LIST) or the triggering order is undefined (thus SynapseHandlers are kept in a SET)?

In the latter case, it could be useful to add yet another attribute (like for IdentityHandlers): "priority".

If HandlerB must be triggered after HandlerA, then this snippet could express this requirement (assuming that handlers with lower values of priority are executed before handlers with higher values of priority):

[[synapse_handlers]]
name="HandlerA"
class="<packageName>.HandlerAImplementationClass"
priority=100

[[synapse_handlers]]
name="HandlerB"
class="<packageName>.HandlerBImplementationClass"
priority=200

All handlers that do not require being triggered in a specific order will not define their priority (as per current implementation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants