Esempio n. 1
0
  @Command("GetStockInfo")
  public void getStockInfo(Message message) {
    Stock stock = stocks.get(message.get(String.class, "Ticker"));

    MessageBuilder.createConversation(message)
        .toSubject("StockClient")
        .command("UpdateStockInfo")
        .with("Stock", stock)
        .noErrorHandling()
        .reply();
  }
Esempio n. 2
0
  public void callback(Message message) {

    List<Record> records = new ArrayList<Record>();
    records.add(
        new Record(
            1,
            "Mike",
            -40.23f,
            getDate(2004, 5, 2),
            RecordType.Savings,
            new Item[] {new Item(2, "iPhone3G"), new Item(2, null)},
            new String[][] {{"FavoriteColor", "Blue"}, {"Place", "Toronto"}}));
    records.add(
        new Record(
            2,
            "Lillian",
            30.10f,
            getDate(2005, 1, 10),
            RecordType.Savings,
            new Item[] {new Item(1, "iPhone3G"), new Item(1, "MacBookPro15")},
            new String[][] {{"FavoriteColor", "Green"}, {"Place", "Toronto"}}));
    records.add(
        new Record(
            3,
            "Heiko",
            50.50f,
            getDate(2006, 5, 20),
            RecordType.Checking,
            new Item[] {new Item(1, "iPhone3Gs"), new Item(2, "MacBookPro13")},
            new String[][] {{"FavoriteColor", "Orange"}, {"Place", "Germany"}}));

    if (message.hasPart("Recs")) {
      List<Record> recs = message.get(List.class, "Recs");

      for (Record r : recs) {
        System.out.println(">" + r);
      }

      return;
    }

    MessageBuilder.createConversation(message)
        .subjectProvided()
        .with("Records", records)
        .noErrorHandling()
        .sendNowWith(bus);
  }
Esempio n. 3
0
 public void callback(Message message) {
   responsePanel.setText("Calculation result: " + message.get(Double.class, "result") + "");
 }