29 #include "../../MetaData.h"
35 using namespace boost;
37 using namespace rsc::logging;
38 using namespace rsc::runtime;
39 using namespace rsc::threading;
45 transport::InPullConnector* InPullConnector::create(
const Properties& args) {
46 LoggerPtr logger = Logger::getLogger(
"rsb.transport.socket.InPullConnector");
47 RSCDEBUG(logger,
"Creating InPullConnector with properties " << args);
50 args.get<ConverterSelectionStrategyPtr>(
"converters"),
54 args.getAs<
bool> (
"tcpnodelay",
true));
63 ConnectorBase(factory, converters, host, port, server, tcpnodelay),
64 InConnector(factory, converters, host, port, server, tcpnodelay),
65 logger(Logger::getLogger(
"rsb.transport.socket.InPullConnector")) {
77 throw std::runtime_error(
"Cannot handle events when not active");
84 event->mutableMetaData().setReceiveTime();
88 boost::shared_ptr<string> wireData = static_pointer_cast<
string>(
event->getData());
89 string wireSchema =
event->getMetaData().getUserInfo(
"rsb.wire-schema");
93 =
getConverter(wireSchema)->deserialize(wireSchema, *wireData);
94 event->setData(d.second);
95 event->setType(d.first);
97 this->
queue.push(event);
102 return this->
queue.pop();
105 return this->
queue.tryPop();
106 }
catch (
const QueueEmptyException&) {
std::pair< std::string, boost::shared_ptr< void > > AnnotatedData
A combination of data type and the actual data.
Basic message that is exchanged between informers and listeners.
boost::shared_ptr< Factory > FactoryPtr
void handle(rsb::EventPtr event)
Handle event.
virtual ~InPullConnector()
virtual void setScope(const Scope &scope)
EventPtr raiseEvent(bool block)
Instances of this class receive events from a bus that is accessed via a socket connection.
FactoryPtr getDefaultFactory()
rsc::threading::SynchronizedQueue< EventPtr > queue
This class is intended to be used as a base class for connector classes of the socket-based transport...
const uint16_t DEFAULT_PORT
ConverterPtr getConverter(const std::string &key) const
Try to find a suitable converter for key .
converter::ConverterSelectionStrategy< std::string >::Ptr ConverterSelectionStrategyPtr
boost::shared_ptr< Event > EventPtr
Scope is a descriptor for a hierarchical channel of the unified bus.
virtual void setScope(const Scope &scope)
const string DEFAULT_HOST