Skip to content

Conversation

@JoooJooo
Copy link
Collaborator

@JoooJooo JoooJooo commented Jun 4, 2019

No description provided.

Copy link
Owner

@devvsda devvsda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address given comments.

log.info(String.format("Processing register endpoint for %s", registerEndpointRequest));

Integer endpointId = clientRegisterationService.registerEndpoint(registerEndpointRequest);
String endpointId = clientRegisterationService.registerEndpoint(registerEndpointRequest);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why conversion ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If converting to string, then use UUID, and change .sql file as well.

int clientId = clientDetails.getClientId();


EndpointDetails endpointDetails = registerationDao.getEndpointDetails(clientId, endpointName);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for moving this to DocumentDB from MySQL.

// validate.
// Get ClientId , and EndpointId.
ClientDetails clientDetails = registerationDao.getClientDetails(executeWorkflowRequest.getClientName());
ClientDetails clientDetails = executeWorkflowServiceHelper.getClientDetailsAndSave(executeWorkflowRequest.getClientName());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this name ? getAndSave ?

private RabbitMQOperation rabbitMQOperation;

@Inject
private RedisCache redisCache;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally any caching service should not be composite in any class. It will create problem, if we want to move away from Redis in future.

Its always recommended to put all caching logic in one class, and inject that class in required classes.

We can take it later, but just mark it as TODO.

* @return EndpointDetails
*/
public ClientDetails getClientDetailsAndSave(String clientName) {
String cacheKey = clientName;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this.

dbObjectInput.append(ExecutionDocumentConstants.Fields.ENDPOINT_NAME, endpointDetails.getEndpointName());
dbObjectInput.append(ExecutionDocumentConstants.Fields.ENDPOINT_DETAILS, JSONLoader.stringify(endpointDetails));
collection.insertOne(dbObjectInput);
log.debug(String.format("EndPoint details are inserted : %s inserted successfully in \n collection : %s and db : %s", endpointDetails, "graph_endpoint", "shepherd_graph_endpoint"));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove all the hardcoded strings. Please make this habit from day#1. Use root level constants file for the same.

}
}
} catch (MongoWriteException e) {
log.error(e.getMessage(), e);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

improve logging. please use logging written as reference. Try to use single standard throughtout the service.

log.info(String.format("created a new Connection Id %s on %s:%d/%s",consumerConnection.getId(),hostName,portNumber,virtualHost));
}else{
log.warn("Connection is already established, No new connection created");
log.warn("Connection is already established, Using already present consumer connection");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either move it to debug or info.

} catch (Exception e) {
log.error("Node-message processing failed.", e);
// TODO : NACK
channel.basicNack(deliveryTag,false,true);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you tested this NAck ? Is it pushing back to queue ? Also, we need to check feature like visibility timeout in rabbit. Reference : https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html

If there is no such feature in Rabbit, then it may harm Shepherd threads. We need to come with some approach for the same.

import java.security.NoSuchAlgorithmException;
import java.util.concurrent.TimeoutException;

public class RedisCacheTest {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for adding UTs. Awesome :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants