Mule-Flow: Checking Required Properties

I have a mule flow with an amqp inbound and outbound endpoint, here is a simplified example:

<flow name="foobar">

  <inbound-endpoint ref="amqp_inbound" />

  <transformer ref="some_xsl_transformer" />

  <outbound-endpoint ref="amqp_outbound"/>

</flow>

The amqp configuration is like so:

<amqp:endpoint name="amqp_inbound" queueName="${inbound.q.name}" connector-ref="amqpConnector" exchange-pattern="one-way" />

<amqp:connector
    name="amqpConnector"
    host="${q.host}"
    port="${q.port}"
    username="${q.username}"
    password="${q.password}"
    prefetchCount="${q.prefetchcount}"
    ackMode="MANUAL" />

What I would like to do is check the existence of the required properties when the application is deployed. If they are not present I would like to provide an error message with the missing required properties and gracefully shut down. With regular spring beans I have been implementing IntializingBean and checking required properties in the InitializingBean#afterPropertiesSet() method.

I would like to do something similar for properties that are referenced only by the mule flow, how is it possible? i.e. if ${q.username} is missing, do not deploy the application and throw an error message. Does mule allow such a thing?

Answers


In that case, use:

<context:property-placeholder
         location="classpath:config.properties"
         ignore-unresolvable="false" />

to load your properties, as Spring will throw an exception thus will prevent the application from loading.


Need Your Help

To fetch value of particular textbox

php ajax session textbox

Here, I am using session to store multiple textbox value.

wpf - Grid column not filling remaining space when other column's contents are collapsed

wpf xaml grid multiple-columns

I've got a grid with 3 columns: the first has its Width set to "*", which I have been led to believe will make it fill up any remaining space left by the other columns. The second has a width of 8,...