Mule ESB 3 not getting port value from property file - properties

In my configuration file, I have this...
<spring:beans>
<context:property-placeholder
location="classpath:sbg-esb.properties" />
</spring:beans>
My properties file looks like this...
# Primary endpoint
esb.endpoint=localhost
esb.port=8081
The endpoint in the config file looks like this...
<http:inbound-endpoint exchange-pattern="request-response" host="${esb.endpoint}" port="${esb.port}" doc:name="Incoming localhost"/>
When starting the Mule Server I get the following error...
Invalid bean definition with name 'sbg-mobile-direction-flow' defined in null: Could not resolve placeholder 'esb.port' in string value "${esb.port}
I don't get any error if all I do is use the esb.endpoint value in the properties file. Once I put in the esb.port value the server breaks as described. Is there a problem with integer values? Am I screwing up the properties file somehow? I thought perhaps using "port" was messing it up but I changed the name to esb.esb.port-like-thing and that got the same error. Any help would be appreciated.
MORE INFO
I took the port out of the properties file. I added the following.
esb.wsdlLocation=http\://dev.example.com/services/Mobile/LinkDevice/soap_server.php?wsdl
The Server breaks with the same error. That would seem to mean that whatever is wrong doesn't have anything to do with port value itself. No properties after the first one are being read correctly.

Related

Invalid content error on compression:extract

I am attempting to use the zip-extract method in a foreach loop to unzip several files. When I attempt to deploy the project the following error is returned:
Invalid content was found starting with element 'compression:extract'. One of >'{"http://www.mulesoft.org/schema/mule/core":annotations, >"http://www.mulesoft.org/schema/mule/core":abstract-message-processor, >"http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-message-processor}' is expected.
The actual code is:
<compression:extract doc:name="Extract" doc:id="9119d722-95eb-4aee-a734-50e2a2825449" >
<set-payload value="#[payload]" />
<compression:extractor >
<compression:zip-extractor />
</compression:extractor>
</compression:extract>
I have not been able to find anything online that would point towards a solution.
It look like accidentally a <set-payload> was put inside the <compression:extract> element. Also it doesn't make sense at all because it puts the payload as the payload, which it is already is. Just remove that line.
Maybe the intention was to use <compression-compressed>?
Example:
<compression:extract>
<compression:compressed>#[payload]</compression:compressed>
<compression:extractor>
<compression:zip-extractor/>
</compression:extractor>
</compression:extract>
payload is already the default, so it is not needed.

jboss-cli property format for path attribute

As explained in JBoss EAP 7 documentation, one can pass in a properties file to the CLI instance with the --properties flag.
I'm trying to create a generic script for logging profiles.
This is my properties file:
profilename=myProfileName
filepath=/some/dir/somefile.log
And this is my script:
set profilename=${profilename}
set filepath=${filepath}
/profile=full-ha/subsystem=logging/logging-profile=$profilename:add
/profile=full-ha/subsystem=logging/logging-profile=$profilename/periodic-size-rotating-file-handler=myHandler:add(file={"relative-to" => "some.dir","path" => $filepath},suffix=.yyyy-MM-dd,max-backup-index=50,rotate-on-boot=true,rotate-size=20m)
The script doesn't generate any error and completes successfully, and the $profilename variable is correctly replaced by its value.
But the $filepath variable seems to be a problem:
<logging-profile name="myProfileName">
<periodic-size-rotating-file-handler name="myHandler" rotate-on-boot="true">
<file relative-to="some.dir" path="$filepath}"/>
<rotate-size value="20m"/>
<max-backup-index value="50"/>
<suffix value=".yyyy-MM-dd"/>
</periodic-size-rotating-file-handler>
</logging-profile>
What is the specific format to use so that a variable can be used for the path attribute?
Edit: tested with JBoss EAP 7.2, and now it works as expected, so I guess it was indeed a bug.
I know this is very late answer, but is the filepath variable last one in your list ?
Because this seems like a line ending issue if add new line at the end this would get picked up correctly.

Issues with overriding the Mule Watermark (SF Polling) in flow via ObjectStore:store

I have defined the object store as following:
<objectstore:config name="objectStore" objectStore-ref="_defaultUserObjectStore"/>
And am trying to modify the watermark variable defined by name "lastmodified" in object store via a flow which call
<objectstore:store key="lastmodified" value-ref="#[payload.lastmodified]" overwrite="true" config-ref="objectStore" doc:name="Default User Object Store"/>
Note: payload.lastmodified has appropriate value of "2016-06-29T15:08:45.000Z" in it.
I am not seeing any error on console but when the next time the Poll executes it doesn't read the updated value of the watermark.
Any pointer would be surely helpful.
Thanks.
Instead of the method used above, try using poll-watermarking. Can set you update expression in poll-watermarking and if needed, can use object store also.
I fixed it by making changing the object store config to: <objectstore:config name="objectStore" partition="mule.watermark" doc:name="ObjectStore: Connector"/>

How to read properties from .properties file in Mule

I'm trying to use Mule Credentials Vault security feature.
I've created .properties file, Security Property Placeholder and defined the key and encryption algorithm.
Now I want to use some of the properties from the file when I return HTTP response.
I have the file src/main/resources/data.properties that contains for example:
In my canvas, under Configuration XML I added:
<secure-property-placeholder:config name="Secure_Property_Placeholder" key="24681357" location="data.properties" doc:name="Secure Property Placeholder" encryptionAlgorithm="DES"/>
<set-variable variableName="card.number" value="${number}" />
In my canvas I have message flow that builds xml 'Create XML response based on User'. The value in settings is:
This doesn't work. The error I get is:
-> org.mule.module.launcher.DeploymentInitException: IllegalArgumentException: Could not resolve placeholder 'key' in string value "${key}"
-> Caused by: org.mule.api.lifecycle.InitialisationException: Invalid bean definition with name 'org.mule.autogen.bean.13' defined in null: Could not resolve placeholder 'key' in string value "${key}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'key' in string value "${key}"
-> Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'key' in string value "${key}"
Does anyone know how can I read the properties from .properties file (credentials vault)? And then use it in my flow?
Thanks,
Keren
If you simply want to get the value for the property number and add it into the XML you can use ${number} from .properties. No need to define any other variables in Configuration XML.
<set-payload value="<user><name>Royal Bank of Canada</name><id>Royal_Bank_Of_Canada</id><cc><company>>Visa</company><number>${number}</number><secret>123</secret></cc></user>" doc:name="Set Payload"/>
However note that the property placeholder is resolved at startup so you will not be able to dynamically retrieve a property based on some user input. For this you will have to do some Java coding. This SO post gives you some hints on how this can be achieved. Based on those answers I have created a simple example on how this can be done with a very simple helper bean.
I'm afraid you just can't. The Mule Credentials Vault is an enterprise feature and therefore tipically you won't have access to the source code unless you are a MuleSoft customer.
Even if you were a customer, the api you'd use would be sort of unsupported. I suggest to manually create a custom java component levearing your code and Jasypt (not as a property placeholder but as a library).
The other option, if you are a customer (I guess you are given you are using the credentials vault) is to contact the official support so they take care of it for you.
The property placeholder is used resolve at startup so you will not be able to dynamically retrieve a property based on some user input.
Use ${propertyName} from .properties in MEL to access particular property
From Dataweave you can read it as given below
p('variablename')
where variablename is defined in property files ex: variablename = 15

BizTalk Receive binary file correlated on RecievedFileName

I'm having problem with routing a message of binary file to a running instance of an Orchestration using correlation of context property: ReceivedFileName. The correlation is initialized using a send with dummy file where in the Orchestration sets the ReceivedFileName context property of the message and the property gets promoted. After that routing fails of the message being received (as XmlDocument) and I can see that the ReveivedFileName context property of that message has not been promoted should it be like that? I cant figure out any way to get it promoted so I just want to make sure it should be like this.
The file names are identical but I noticed that the ReceivedFileName property of the send message doesn't have the path whereas the received message has path + file name. I have tried to add the path to the send message(sounds strange though, read it some where) but it doesn't change the outcome.
While you can set Context Proerties in an Orchestration, they are not Promoted.
You have to use the Correlation Technique described here to have the Properties Promoted when they hit the MessageBox: http://blogs.biztalk360.com/property-promotion-inside-orchestration/
Basically, you Initialize a Correlation Set based on the Properties you need Promoted.
As Ben Runchey pointed out in a comment above one have to resort to a custom pipeline and promote the FILE.ReceivedFileName there by calling:
messag.Context.Promote("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", receivedFileName);
I also removed the path from FILE.ReceivedFileName to only have the filename by calling the inmsg.Context.Read("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties")
and altered the value and wrote it back by calling:
inmsg.Context.Write("ReceivedFileName", "http://schemas.microsoft.com/BizTalk/2003/file-properties", receivedFileName);