You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a thread to implement event message subscription (pull consumer) client. The client needs to implement a server program and must call orb->run(), but orb->run() is blocked or in a loop state. How to implement external code (send signal) to make orb->run() exit.
I wanted to use "debug mode" to debug run(), but found that I couldn't enter the code. So come for help.
After searching, all common test cases are very simple and of little help to me, as follows:
int main()
{
...
orb->run() ;
return 0;
}
My test code.
void CTmfClient::TestEvenet()
{
int event_id;
CosNotifyChannelAdmin::InterFilterGroupOperator method = CosNotifyChannelAdmin::InterFilterGroupOperator::AND_OP;
CosNotifyChannelAdmin::ConsumerAdmin_ptr consumerAdmin = eventChannel->new_for_consumers(method, event_id);
CosNotification::EventTypeSeq_var add_event_type_hearts = new CosNotification::EventTypeSeq;
std::map<std::string, std::string>::iterator iter = event_map_list.begin();
add_event_type_hearts->length(event_map_list.size());
for (int idx = 0; iter != event_map_list.end(); ++iter,++idx)
{
(*add_event_type_hearts)[idx].domain_name = CORBA::string_dup("tmf_mtnm");
(*add_event_type_hearts)[idx].type_name = CORBA::string_dup(iter->first.c_str());
}
CosNotification::EventTypeSeq_var remv_event_type_hearts = new CosNotification::EventTypeSeq;
consumerAdmin->subscription_change(add_event_type_hearts, remv_event_type_hearts);
consumerAdmin->remove_all_filters();
CosNotification::EventTypeSeq_var add_event_type_alarms = new CosNotification::EventTypeSeq;
add_event_type_alarms->length(1);
(*add_event_type_hearts)[0].domain_name = CORBA::string_dup("tmf_mtnm");
(*add_event_type_hearts)[0].type_name = CORBA::string_dup("NT_ALARM");
CosNotifyFilter::ConstraintExpSeq_var alarmExps = new CosNotifyFilter::ConstraintExpSeq;
alarmExps->length(2);
(*alarmExps)[0].event_types = add_event_type_alarms;
(*alarmExps)[0].constraint_expr = CORBA::string_dup("1==1");
(*alarmExps)[1].event_types = add_event_type_alarms;
(*alarmExps)[1].constraint_expr = CORBA::string_dup("1==1");
CosNotifyFilter::FilterFactory_ptr filterFactory = eventChannel->default_filter_factory();
CosNotifyFilter::Filter_ptr alarmFilter = filterFactory->create_filter("TCL");
try
{
alarmFilter->add_constraints(alarmExps);
}
catch (CosNotifyFilter::InvalidConstraint & e)
{
std::cout << e.constr.constraint_expr;
}
consumerAdmin->add_filter(alarmFilter);
EventConsumer * eventConsumer = new EventConsumer;
CosNotifyComm::StructuredPushConsumer_ptr pushConsumer = eventConsumer->_this();
int proxy_id;
CosNotifyChannelAdmin::ProxySupplier_ptr proxySupplier = consumerAdmin->obtain_notification_push_supplier(CosNotifyChannelAdmin::ClientType::STRUCTURED_EVENT, proxy_id);
CosNotifyChannelAdmin::StructuredProxyPushSupplier_ptr proxyPushSupplier = CosNotifyChannelAdmin::StructuredProxyPushSupplier::_narrow(proxySupplier);
proxyPushSupplier->connect_structured_push_consumer(pushConsumer);
Any::setDaf(GetAnyFactory());
orb->run();// Blocked state or loop state, what signal is sent to make the function jump out of the loop or blocked state, and how to implement the code?
}
The text was updated successfully, but these errors were encountered:
Create a thread to implement event message subscription (pull consumer) client. The client needs to implement a server program and must call orb->run(), but orb->run() is blocked or in a loop state. How to implement external code (send signal) to make orb->run() exit.
I wanted to use "debug mode" to debug run(), but found that I couldn't enter the code. So come for help.
After searching, all common test cases are very simple and of little help to me, as follows:
My test code.
The text was updated successfully, but these errors were encountered: