<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
	xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.1.0"
	xsi:schemaLocation="
		http://www.osgi.org/xmlns/blueprint/v1.0.0 
		http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
		http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0
		http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.1.0.xsd
		http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.1.0
		http://aries.apache.org/schemas/blueprint-ext/blueprint-ext-1.1.xsd
">

	<bean id="queueNameFactory" class="org.opennms.core.camel.JmsQueueNameFactory">
		<argument value="Minion"/>
		<argument value="Heartbeat"/>
	</bean>

	<cm:property-placeholder id="heartbeatProperties" persistent-id="org.opennms.minion.core.heartbeat" update-strategy="none">
		<cm:default-properties>
			<cm:property name="queueName">
				<bean factory-ref="queueNameFactory" factory-method="getName"/>
			</cm:property>
		</cm:default-properties>
	</cm:property-placeholder>

	<!-- ActiveMQ component provided by minion-core -->
	<reference id="queuingservice" interface="org.apache.camel.Component"
		filter="(alias=opennms.broker)" />

	<bean id="marshaller" class="org.opennms.core.camel.JaxbUtilsMarshalProcessor">
		<argument value="org.opennms.minion.core.api.MinionIdentityDTO" />
	</bean>

	<!-- A canonical source for this Minion's identity -->
	<reference id="minion" interface="org.opennms.minion.core.api.MinionIdentity" />

	<bean id="minionIdentity" class="org.opennms.minion.core.api.MinionIdentityDTO">
		<argument ref="minion" />
	</bean>


	<camelContext id="heartBeatCamelContext"
		xmlns="http://camel.apache.org/schema/blueprint">
		<propertyPlaceholder id="properties" location="blueprint:heartbeatProperties" />

		<route id="heartBeatRoute">
			<from
				uri="timer://minionTimer?fixedRate=true&amp;daemon=true&amp;period=60000" />
			<setBody>
				<simple>${ref:minionIdentity}</simple>
			</setBody>
			<bean ref="marshaller" />
			<to uri="queuingservice:{{queueName}}" />
		</route>
	</camelContext>

</blueprint>
