Load dynamic sequence from Registry - WSO2 ESB - wso2-esb

I wanted to load a sequence dynmically in the API. If I create sequence is the same ESB Solution project and load, it was successfuly referred the sequence:
<property description="supplierSeq" expression="json-eval($.sequence)" name="supplierSeq" scope="default" type="STRING"/>
<sequence description="" key="{get-property('supplierSeq')}"/>
But if I tried to create the sequence in the registry resource project as mentioned here, I could not load it.
<property description="supplierSeq" expression="json-eval($.sequence)" name="supplierSeq" scope="default" type="STRING"/>
<sequence description="" key="{concat('gov:sequence/', get-property('supplierSeq'))}"/>
Please advise.

I have make the registry path within script mediator and added as a property:
payload.sequence = "gov:sequence/" + supplier + "_availability.xml";
and then referred for the sequence:
<sequence description="" key="{get-property('supplierSeq')}"/>
This worked

Related

TeamCity API method to get Slack notification info

Im trying to list my TeamCity builds in my own site with the TeamCity API to create dashboard. One feature I need is to notify the right person. To do so I set in the build setting the right Slack channel as the notification configuration.
My question is, is there a way to get this info from the TeamCity API? And if not, is there any way to get this info from other place?
Thanks!
UPD: This is how the Slack notifier is configured:
On this picture we choose the 'Slack' option in menu.
Here in bottom option we set the slack channel for this build
You get get the information about Build features via TeamCity REST API and the features will in turn contain information about configured Slack notifiers.
Example of a response for a GET request to https://<serverUrl>/app/rest/buildTypes/id:MY_BUILD_CONFIGURATION_ID:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<buildType id="MY_BUILD_CONFIGURATION_ID" name="Build configuration name" projectName="project name" projectId="PROJECT_ID" href="/app/rest/buildTypes/id:MY_BUILD_CONFIGURATION_ID" webUrl="https://<serverUrl>/viewType.html?buildTypeId=MY_BUILD_CONFIGURATION_ID">
...
<features count="1">
<feature id="BUILD_EXT_63" type="notifications">
<properties count="11">
<property name="branchFilter" value="+:<default>
+:br_name"/>
<property name="buildFinishedFailure" value="true"/>
<property name="buildFinishedSuccess" value="true"/>
<property name="firstSuccessAfterFailure" value="true"/>
<property name="notifier" value="jbSlackNotifier"/>
<property name="plugin:notificator:jbSlackNotifier:addBranch" value="true"/>
<property name="plugin:notificator:jbSlackNotifier:addBuildStatus" value="true"/>
<property name="plugin:notificator:jbSlackNotifier:channel" value="#slack-channel-name"/>
<property name="plugin:notificator:jbSlackNotifier:connection" value="PROJECT_EXT_10"/>
<property name="plugin:notificator:jbSlackNotifier:maximumNumberOfChanges" value="10"/>
<property name="plugin:notificator:jbSlackNotifier:messageFormat" value="verbose"/>
</properties>
</feature>
</features>
...
</buildType>
The property you are interested in is plugin:notificator:jbSlackNotifier:channel

Unable to read HTTP headers in an API resource

I am trying to read HTTP header from inside an API that I defined in the ESB. I have tried various methods (see below) all of them print out "null" in the logs.
<log level="custom">
<property name="LOG-POSITION___________________________" value="...4"/>
<property name="AXIS2___________________________" expression="$axis2:accept"/>
<property name="AXIS2___________________________" expression="$axis2:Accept"/>
<property name="AXIS2___________________________" expression="$axis2:ACCEPT"/>
<property name="CTX___________________________" expression="$ctx:accept"/>
<property name="CTX___________________________" expression="$ctx:Accept"/>
<property name="CTX___________________________" expression="$ctx:ACCEPT"/>
<property name="TRP___________________________" expression="$trp:accept"/>
<property name="TRP___________________________" expression="$trp:Accept"/>
<property name="TRP___________________________" expression="$trp:ACCEPT"/>
</log>
I can't see why it is not working.
Here is the synapse code to read and log the content-type http header. Here $trp stands for the transport header.
<log level="custom">
<property name="Content_Type" expression="$trp:Content-Type"/>
</log>
Ref: https://docs.wso2.com/display/ESB500/Synapse+XPath+Variables
If it doesn't work, enable wire logs and post the logs in the question.
I have found an answer to this by looking through existing code, and doing a bit of trial and error.
The expression "$trp:Accept" works, but it must be used before using either a call or send mediator.
For any others experiencing this issue, move the property mediator for grabbing this to the beginning of your proxy or api and the values should come through.

Jackrabbit Indexing Config Whitelisting (Magnolia CMS 5.5.5 Fulltextsearch)

I want to do a whitelisting of what properties are indexed/searched and shown in excerpt with a Magnolia search.
I am changing the indexing_configuration.xml in my website workspace.
Removing the index and restarting magnolia did not change anything...
By now I have this in my indexing_configuration.xml (next to other stuff)
but these are the String properties I want to include in my ecxcerpt the rest should be excluded:
<index-rule nodeType="nt:hierarchyNode">
<property boost="10" useInExcerpt="true">introTitle</property>
<property boost="1.0" useInExcerpt="true">introAbstract</property>
<property boost="1.0" useInExcerpt="true">contentText</property>
<property boost="1.0" useInExcerpt="true">subText</property>
<property boost="10" useInExcerpt="true">title</property>
<!-- exclude jcr:* and mgnl:* properties -->
<property isRegexp="true" nodeScopeIndex="false" useInExcerpt="false">.*:.*</property>
</index-rule>
<index-rule nodeType="mgnl:contentNode">
<property boost="5" nodeScopeIndex="false" useInExcerpt="true">introTitle</property>
<property boost="2" nodeScopeIndex="false" useInExcerpt="true">introAbstract</property>
<property boost="2" nodeScopeIndex="false" useInExcerpt="true">contentText</property>
<property boost="2" nodeScopeIndex="false" useInExcerpt="true">subText</property>
<property boost="5" nodeScopeIndex="false" useInExcerpt="true">title</property>
<!-- exclude jcr:* and mgnl:* properties -->
<property isRegexp="true" nodeScopeIndex="false" useInExcerpt="false">.*:.*</property>
</index-rule>
How can i get this to work as intended? Thanks for your help..
Most likely cause is that Magnolia/JR is not seeing your new configuration. Did you change your repo configuration (workspace.xml in website workspace) to point it to new index configuration?
Default looks like:
<SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
<param name="path" value="${wsp.home}/index" />
<!-- SearchIndex will get the indexing configuration from the classpath, if not found in the workspace home -->
<param name="indexingConfiguration" value="/info/magnolia/jackrabbit/indexing_configuration.xml"/>
and you need to point it to your new file.
Also not sure why you are setting indexing based on nt:hierarchyNode or mgnl:contentNode rather then using more specific mgnl:page/mgnl:component

WSO2 ESB - how to dynamically set value to WSDL Endpoint URI using Property Meditor

I have an endpoint (WSDL) with following settings:
<endpoint>
<wsdl port="portName"
service="serviceName"
uri="http://example.com/services/service1.wsdl"/>
</endpoint>
And I have a separate xml file containing my settings for those 3 attributes: uri, service, and port. I can get their value from the xml.
<property expression="get-property('registry','gov:trunk/services/Config.xml')"
name="gc" scope="default" type="OM"/>
<log level="custom">
<property expression="$ctx:gc//wsdl//uri" name="uri"/>
<property expression="$ctx:gc//wsdl//service" name="service"/>
<property expression="$ctx:gc//wsdl//port" name="port"/>
</log>
Now, my question is: how do I set those 3 values dynamically to my endpoint?
I only need this endpoint once, and there is no need to create template for this purpose, but I can't find any resource to help me do that.
Can anyone share some knowledge and experience?
Thanks

Payara setup together with sniffy profiler

I'm trying to profile application running on Payara server with Sniffy profiler.
Maven dependency is added and file web.xml is modified according to the documentation.
I have added sniffy.jar to the payara\payara41\glassfish\domains\domain1\lib\ folder.
I have modified glassfish-resources.xml file as follows:
<resources>
<jdbc-resource enabled="true" jndi-name="jdbc/Agenda" object-type="user" pool-name="AgendaPool">
<description/>
</jdbc-resource>
<jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="oracle.jdbc.pool.OracleDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="AgendaPool" non-transactional-connections="false" ping="false" pool-resize-quantity="2" pooling="true" res-type="javax.sql.DataSource" statement-cache-size="0" statement-leak-reclaim="false" statement-leak-timeout-in-seconds="0" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
<property name="URL" value="sniffer:jdbc:oracle:thin:#localhost:1521:XE"/>
<property name="User" value="XXX"/>
<property name="Password" value="XXX"/>
<property name="driverClass" value="io.sniffy.MockDriver"/>
</jdbc-connection-pool>
</resources>
I'm able to see HTTP methods response times but not queries response times:
No query response time.
Is my configuration correct? Why there are no response times for executed queries?
Sniffy doesn't work with oracle.jdbc.pool.OracleDataSource
See more details in this question: Invalid Oracle URL specified with Sniffy