I am trying to set variable if url contains text "verification"
<set-variable name="pathQuery" value="#(context.Request.Url.Contains("verification"))" />
I get the following error
Error in element 'set-variable' on line 16, column 10: 'IUrl' does not
contain a definition for 'Contains' and the best extension method
overload 'Queryable.Contains(IQueryable, string)'
requires a receiver of type 'IQueryable'
How do I set this?
You could use the code as below:
<set-variable name="pathQuery" value="#(context.Request.Url.Path.Contains("verification"))" />
For more details, you could refer to this article.
Related
Good day,
Hope you are well.
I am trying to use the Vincere API, and trying to query the response to only return where private_job:0. I am using Postman to test the API.
When I use the below request, doing my best to follow the instructions on the Documentation:
https://domain.vincere.io/api/v2/job/search/fl=job_title,private_job;sort=published_date asc?q=private_job:0
I get the following response:
"Parse exception Unexpected end of input, expected term_char, ws0, term or term_end (line 1, pos 14):\nprivate_job:0\n ^\n"
If I remove ?q=private_job:0, I get a valid response.
I am clearly doing something wrong. Please assist.
in query parameter the key name is q ,
q=private_job:0
but in documentation it says instead of q it should be fq
https://domain.vincere.io/api/v2/job/search/fl=job_title,private_job;sort=published_date asc?fq=private_job:0
Also if you are using special character q=private_job:0 # , then give the value in the query parameter session of postman it will url encode it automatically for you
This stumped me as well, turns out my issue was twofold.
Firstly, this error refers to their URL parser expecting to see the end character %23, so your query string needs to end with that.
Secondly, I was attempting to query the job_type and using the actual string value ie. job_type:PERMANENT%23. This actually needs to be the enum value (1 in this case).
When I try to use a json-logger in Mule 4. I'm getting this error. I'm trying to log a error object here but it is not getting successfull. Please find the error object below.
I sorted out the issue. The issue was we cannot give JSON in the MESSAGE section of json-logger. When i changed it to a string. It worked
The MESSAGE section is meant to describe what you are going to Log.
It looks like you are trying to use the function stringifyNonJSON() with a Mule error and treat it like a String. Without more details of the flow and the payload it is not possible to have more insights.
You could try to create a string from the payload manually first and use that as the parameter, as the function is not able to handle this case apparently.
How to replace value of tenantId in the following url: /{tenantId}/users? I need to replace it with a value from jwt token. It's trivial for query param, but path params are not documented anywhere.
If I'm getting you right, you want to rewrite the uri in the inbound section?
If your url is:
https://stackoverflow.com/{tenantId}/users
Then you can rewrite the Uri with following command:
<rewrite-uri template="#(context.Request.OriginalUrl.Path.Replace(context.Request.MatchedParameters["tenantId"], "<YOUR-JWT-TOKEN-VALUE>"))" copy-unmatched-params="true" />
I am trying to create an event formatter for MySql in WSO2 but am hitting a problem. It appears to be linked to the use of "Composite Key Columns". The error I am getting is:
ERROR - {MysqlEventAdaptorType}
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Window = '15'' at line 1
This only happens if I use a two or more keys in the formatter:
<eventFormatter name="GenericAccountSQLFormatter" statistics="enable"
trace="enable" xmlns="http://wso2.org/carbon/eventformatter">
<from streamName="GenericAccountMeasureStream" version="1.0.0"/>
<mapping customMapping="disable" type="map"/>
<to eventAdaptorName="APCSQLOut" eventAdaptorType="mysql">
<property name="table.name">AccountStats</property>
<property name="update.keys">AccountId,Window</property>
<property name="execution.mode">insert-or-update</property>
</to>
</eventFormatter>
Removing either of the keys (AccountId, Window) then the formatter will send data to MySQL.
Can anyone help?
This is a bug and happens when existing events are sent to a MySQL adaptor with composite keys. Created a jira to track this and the source patch is also available there.
If you don't want to create/apply a patch, then as a quick workaround for now - you can output a composite key from CEP query by concatenating the two attributes and use that as the key in formatter.
UPDATE
The source patch with the fix and build instructions are now available in the jira here. Once built, you need to apply it as a patch to CEP. To apply it as a patch, create a directory named patch0xyz ( xyz are digits as in patch0135, also make xyz > 100) in <CEP>/repository/components/patches and then place the jar inside it. Then you need to rename the jar as org.wso2.carbon.event.output.adaptor.mysql_1.0.1.jar. Then restart the server.
I'll copy past a part from the mule website guide:
<jdbc:query key="outboundInsertStatement"
value="INSERT INTO TEST (ID, TYPE, DATA, ACK) VALUES (#[map-payload:ID],
#[map-payload:TYPE],#[map-payload:DATA], #[map-payload:ACK])"/>
I am trying to do something very close to this only I want to use a custom object and not the java.util.map which i understand is what is expected.
Could I get an explanation as to what does #[map-payload:ACK] exactly means? I dont understand the syntax.
Is map-payload some sort of default type?
Could I use that syntax to use a custom object I created? (Some MesssageObj class with some fields)
The syntax:
#[evaluator:expression]
is used by the Mule Expression Evaluation framework.
If you look in the table that lists all evaluators, you'll find map-payload among may other evaluators.
So the example you have above means that:
it is expected the in-flight message will have a payload of type java.util.Map,
the values for the ID, TYPE, DATA and ACK columns in the insert query will be extracted from the map payload under eponymous keys.
Of course, feel free to use any other evaluator that better match your in-flight message payload.