Skip to content

Commit

Permalink
Perform initial heartbeat after registration.
Browse files Browse the repository at this point in the history
  • Loading branch information
mmichalek committed Dec 15, 2015
1 parent 734d584 commit f8d51cc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
7 changes: 5 additions & 2 deletions symmetric-client-clib/inc/service/RegistrationService.h
Expand Up @@ -28,18 +28,21 @@
#include "service/DataLoaderService.h"
#include "service/ConfigurationService.h"
#include "model/Node.h"
#include "service/DataService.h"

typedef struct SymRegistrationService {
SymNodeService *nodeService;
SymDataLoaderService *dataLoaderService;
SymParameterService *parameterService;
SymConfigurationService *configurationService;
SymDataService *dataService;
void (*registerWithServer)(struct SymRegistrationService *this);
unsigned short (*isRegisteredWithServer)(struct SymRegistrationService *this);
void (*destroy)(struct SymRegistrationService *this);
} SymRegistrationService;

SymRegistrationService * SymRegistrationService_new(SymRegistrationService *this, SymNodeService *nodeService, SymDataLoaderService *dataLoaderService,
SymParameterService *parameterService, SymConfigurationService *configurationService);
SymRegistrationService * SymRegistrationService_new(SymRegistrationService *this, SymNodeService *nodeService,
SymDataLoaderService *dataLoaderService, SymParameterService *parameterService,
SymConfigurationService *configurationService, SymDataService *dataService);

#endif
2 changes: 1 addition & 1 deletion symmetric-client-clib/src/core/SymEngine.c
Expand Up @@ -194,7 +194,7 @@ SymEngine * SymEngine_new( SymEngine *this, SymProperties *properties) {
this->dataExtractorService = SymDataExtractorService_new(NULL, this->nodeService, this->outgoingBatchService, this->dataService,
this->triggerRouterService, this->parameterService, this->platform);
this->registrationService = SymRegistrationService_new(NULL, this->nodeService, this->dataLoaderService, this->parameterService,
this->configurationService);
this->configurationService, this->dataService);
this->pullService = SymPullService_new(NULL, this->nodeService, this->dataLoaderService, this->registrationService,
this->configurationService, this->nodeCommunicationService);
this->pushService = SymPushService_new(NULL, this->nodeService, this->dataExtractorService, this->transportManager, this->parameterService,
Expand Down
10 changes: 6 additions & 4 deletions symmetric-client-clib/src/service/RegistrationService.c
Expand Up @@ -39,8 +39,8 @@ void SymRegistrationService_registerWithServer(SymRegistrationService *this) {
if (isRegistered) {
SymNode *node = this->nodeService->findIdentity(this->nodeService);
if (node != NULL) {
SymLog_info("Successfully registered node [id=%s]\n", node->nodeId);
// TODO: this->dataService->heartbeat(this->dataService);
SymLog_info("Successfully registered node [id=%s]", node->nodeId);
this->dataService->heartbeat(this->dataService, 1);
} else {
SymLog_error("Node identity is missing after registration. The registration server may be misconfigured or have an error");
isRegistered = 0;
Expand Down Expand Up @@ -73,15 +73,17 @@ void SymRegistrationService_destroy(SymRegistrationService *this) {
free(this);
}

SymRegistrationService * SymRegistrationService_new(SymRegistrationService *this, SymNodeService *nodeService, SymDataLoaderService *dataLoaderService,
SymParameterService *parameterService, SymConfigurationService *configurationService) {
SymRegistrationService * SymRegistrationService_new(SymRegistrationService *this, SymNodeService *nodeService,
SymDataLoaderService *dataLoaderService, SymParameterService *parameterService,
SymConfigurationService *configurationService, SymDataService *dataService) {
if (this == NULL) {
this = (SymRegistrationService *) calloc(1, sizeof(SymRegistrationService));
}
this->nodeService = nodeService;
this->dataLoaderService = dataLoaderService;
this->parameterService = parameterService;
this->configurationService = configurationService;
this->dataService = dataService;
this->isRegisteredWithServer = (void *) &SymRegistrationService_isRegisteredWithServer;
this->registerWithServer = (void *) &SymRegistrationService_registerWithServer;
this->destroy = (void *) &SymRegistrationService_destroy;
Expand Down

0 comments on commit f8d51cc

Please sign in to comment.