I've been using ActiveMQ and JMS to get OZW stomp messages into a Spring app in the easiest possible way. The problem is that my Message Driven Bean only gets the body value from JMS not the headers. So I've amended the code of Thrift4OZW->Main.cpp to add the header values to the message body in a simple JSON string. And added a command line flag (-j) to turn the functionality off or on. Not sure if it's worth integrating into the code since it's really a JMS problem I'm working around rather than a BoostStomp problem, and my C++ is pretty shaky, but here's the patch:
//-----------------------------------------------------------------------------
//
// Callback that is triggered by OpenZWave when a value, group or node changes
//-----------------------------------------------------------------------------
I've been using ActiveMQ and JMS to get OZW stomp messages into a Spring app in the easiest possible way. The problem is that my Message Driven Bean only gets the body value from JMS not the headers. So I've amended the code of Thrift4OZW->Main.cpp to add the header values to the message body in a simple JSON string. And added a command line flag (-j) to turn the functionality off or on. Not sure if it's worth integrating into the code since it's really a JMS problem I'm working around rather than a BoostStomp problem, and my C++ is pretty shaky, but here's the patch:
*\ Main.cpp.orig 2013-03-22 16:36:44.000000000 +0000 --- Main.cpp.new 2013-03-22 19:33:04.000000000 +0000
* 93,98 ** --- 93,102 ---- static STOMP::BoostStomp* stomp_client; static string* notifications_topic = new string("/queue/zwave/monitor");
//----------------------------------------------------------------------------- //
// Callback that is triggered when a value, group or node changes
* 117,122 ** --- 121,152 ---- }
//-----------------------------------------------------------------------------
* 313,320 ** headers["ValueID"] = to_string(_notification->GetValueID().GetId(), std::hex);
}
//
! string empty = "" ;
! stomp_client->send(_notifications_topic, headers, empty);
}
//
g_criticalSection.unlock();
--- 343,352 ----
headers["ValueID"] = to_string(_notification->GetValueID().GetId(), std::hex);
}
//
! string response = "" ;
! if(jsonMessageBody)
! response=jsonifyHeaders(headers);
! stomp_client->send(_notifications_topic, headers,response );
}
//
g_criticalSection.unlock();
* 336,343 ** headers["HomeID"] = to_string(v.GetHomeId(), std::hex);
headers["ValueID"] = to_string(v.GetId(), std::hex);
//
! string empty = "" ;
! stomp_client->send(_notifications_topic, headers, empty);(v.GetHomeId(), std::hex);
headers["ValueID"] = to_string(v.GetId(), std::hex);
//
! string response = "" ;
! if(jsonMessageBody)
! response=jsonifyHeaders(headers);
! stomp_client->send(_notifications_topic, headers,response );
} } // --- 368,377 ---- headers["HomeID"] = to_string
} } //
* 370,375 ** --- 404,410 ---- ("ozwconf,c", po::value(&ozw_conf)->default_value(ozw_config_dir.string()), "our OpenZWave manufacturer database")
("ozwuser,u", po::value(&ozw_user)->default_value(current_dir.string()), "our OpenZWave user config database")
("ozwport,p", po::value(&ozw_port)->default_value("/dev/ttyUSB0"), "our OpenZWave driver port")