Separate Heartbeat and BusinessCard sounds good to me. Both have their own purpose and semantics.
I think Heartbeat message should be similar to Parameter. All relevant information included in one object - no need for additional lookups or queries.
Question related to this - how to make sure each app (component) has unique ID (or name) which is also included in Heartbeat? (And in Parameters as issuedBy value?)
There are two options I can think at the moment:
1. Unique ID has to be provided via properties at startup. From command line, properties file etc. Pros: can be set to human readable meaningful value. Cons: can be missed or duplicated by human error.
2. Random UUID generated at startup. Pros: unique and no human errors. Cons: makes no sense to humans, changed after each restart.
Maybe you have some better idea?
----- Original Message -----
From: Gert Villemos
Sent: 04/10/12 05:21 PM
To: Lauri Kimmel
Subject: Re: Howto add a Heartbeat to a Component
Hi Lauri,Sorry for not answering the other email. I had a lot of things to do over easter. I will return to it tonight...Answers to this email embedded below.Cheers,Gert.1. Fields host, component, requires & provides are public in class BusinessCard. They have no getters and setters. Spring is not able to set values for those fields from xml config.
Exact excption message is - org.springframework.beans.NotWritablePropertyException: Invalid property 'host' of bean class [org.hbird.exchange.businesscard.BusinessCard]: Bean property 'host' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Am I missing something here? Otherwise adding getters and setters for BusinesCard fileds should solve this exception.I will create getters / setters, but see answer to point 3.
2. In the heartbeat route definition there is one extra double quote at the end of second line.Sorry. Fixed.
3. The heartbeat route will not publish business card pojo to the activemq:topic:system. Which I think was desired result. Integer with value 1 is sent as body of message instead.
I managed to get heartbeat running using Java DSL
businessCard = new BusinessCard();
businessCard.component = "...";
businessCard.host = InetAddress.getLocalHost().getHostName();
from("timer:heartbeat?fixedRate=true&period=3000")
.setBody(constant(businessCard))
.to("activemq:topic:system");
and I think its good enough for basic system monitoring at the moment.
Though it doesn't meet service requirements for Heartbeat nor BusinessCard from hbird.de site.The service specifications were inconsistent because I was thinking about simplifying / harmonizing them, letting the business card and the heartbeat be the same message. But that is a bad idea. I have now changed them back.For heartbeat you should use the 'Heartbeat' message type and not the BusinessCard. I have updated the tutorial.If you think its useful to have the host name in the heartbeat as well, or other information, then let me know, then I add them.
Lauri