Re: Howto add a Heartbeat to a Component

10 views
Skip to first unread message

Gert Villemos

unread,
Apr 11, 2012, 4:08:33 AM4/11/12
to Lauri Kimmel, humming...@googlegroups.com
Exactly; heartbeat and businesscard is two different use cases.

I fully agree that the heartbeat should be a single message holding all the data that people are interested in to check 'liveliness' of a component. What is this info? Right now its 
- Component ID.
- Timestamp.
- Time to next heartbeat.

Is the following needed / of interest
- Host?

When the 'Configurator' component is used, then the component ID is automatically used consistently. The configuration request contains an 'id' (a random UUID per default, but can be set to a logical name if desired). This ID is used in all routes for the component requirering an ID, including the heartbeat (the configurator always create a heartbeat service for each component) and the businesscard (again the configurator always create a businesscard service for each component).

The ID of components generated by the configurator can thus be either a UUID (if people are lazy and dont configure) or a logical name. I think a logical name should always be used.

When building a 'new' component in an assembly.xml file, as the 'weather station', then the consistency must be done manually. I think its a good idea to start using Spring properties to define the 'standard' variables. There are some variables that are else multiple places, which can easily lead to inconsistencies.

Cheers,
Gert.






Den 10. apr. 2012 17.46 skrev Lauri Kimmel <lauri....@gmx.com>:

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

 


Reply all
Reply to author
Forward
0 new messages