Skip to content

Commit

Permalink
example of using just a map of keys/values
Browse files Browse the repository at this point in the history
  • Loading branch information
jmazzitelli committed Jul 14, 2015
1 parent daa2e90 commit 4d13bf8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.hawkular.bus.sample.client;

import java.util.HashMap;

import org.hawkular.bus.common.ConnectionContextFactory;
import org.hawkular.bus.common.Endpoint;
import org.hawkular.bus.common.MessageProcessor;
Expand Down Expand Up @@ -56,12 +58,14 @@ public void consume() throws Exception {
protected void onBasicMessage(Person person) {
System.out.println("\n========== RECEIVED MESSAGE START ==========");
System.out.println("Consumed Person:");
System.out.printf("title=[%s], firstN=[%s], lastN=[%s], age=[%d], address.street=[%s]\n",
System.out.printf(
"title=[%s], firstN=[%s], lastN=[%s], age=[%d], address.street=[%s], hobbies=[%s]\n",
person.getTitle(),
person.getFirstName(),
person.getLastName(),
person.getAge(),
person.getAddress().getStreet());
person.getAddress().getStreet(),
person.getHobbies());
System.out.println("Consumed Person.toString: " + person.toString());
System.out.println("Consumed Person.toJSON: " + person.toJSON());
System.out.println("Consumed Person.hashCode: " + person.hashCode());
Expand Down Expand Up @@ -105,6 +109,10 @@ public void produce() throws Exception {
phone2.setDigits("800-WOT-GORILLA");
person.getPhoneNumbers().add(phone1);
person.getPhoneNumbers().add(phone2);
person.setHobbies(new HashMap<String, Number>(3));
person.getHobbies().put("golf", 6);
person.getHobbies().put("cooking", 3);
person.getHobbies().put("tennis", 4);
MessageProcessor processor = new MessageProcessor();
processor.send(pc, person);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
"type": "string"
}
},
"hobbies": {
"description": "A map of hobbies, whose value is a number from 1 to 10 based on how much the person likes it.",
"type": "object",
"javaType": "java.util.Map<String, Number>"
},
"address": {
"description": "The home address of this person.",
"type": "object",
Expand Down

0 comments on commit 4d13bf8

Please sign in to comment.