ServiceDataFeedDeliveryTask.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #include "config.h"
00031
00032 #include "ServiceDataFeedDeliveryTask.hpp"
00033 #include "ServiceInstanceDescription.hpp"
00034 #include "EntityDescription.hpp"
00035
00036 #include <Exception.hpp>
00037
00038 #include <iostream>
00039
00040 using namespace mermaid::support::service;
00041 using mermaid::support::errorhandling::Exception;
00042
00043 ServiceDataFeedDeliveryTask::ServiceDataFeedDeliveryTask (shared_ptr<Service> consumerService, std::string producerEntityName, std::string producerServiceName, std::string dataFeedName, shared_ptr<DataBox> dataBox)
00044 {
00045
00046 consumerService_ = consumerService;
00047 producerEntityName_ = producerEntityName;
00048 producerServiceName_ = producerServiceName;
00049 dataFeedName_ = dataFeedName;
00050 dataBox_ = dataBox;
00051 };
00052
00053 void ServiceDataFeedDeliveryTask::run()
00054 {
00055 try {
00056
00057 consumerService_->processDataFeedInput (producerEntityName_, producerServiceName_, dataFeedName_, dataBox_);
00058 }
00059 catch (Exception &e) {
00060 shared_ptr<ServiceInstanceDescription> serviceInstanceDescription = consumerService_->getServiceInstanceDescription();
00061 shared_ptr<EntityDescription> entityDescription = serviceInstanceDescription->getEntityDescription();
00062
00063
00064 std::cerr << "ServiceDataFeedDeliveryTask : caught an exception while Service was processing a Data Feed input" << std::endl;
00065 std::cerr << "\tException : " << e.what() << std::endl;
00066 std::cerr << "\tProducer Entity Name : " << producerEntityName_ << std::endl;
00067 std::cerr << "\tProducer Service Instance Name : " << producerServiceName_ << std::endl;
00068 std::cerr << "\tData Feed Name : " << dataFeedName_ << std::endl;
00069 std::cerr << "\tData Box contents : " << std::endl << (std::string) ( (*dataBox_)) << std::endl;
00070 std::cerr << "\tConsumer Entity Name : " << entityDescription->getEntityName() << std::endl;
00071
00072 std::cerr << "\tConsumer Service Instance Name : " << serviceInstanceDescription->getServiceInstanceName() << std::endl;
00073 }
00074 };