Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Communication channel transparency #60

Open
wants to merge 25 commits into
base: develop
Choose a base branch
from

Conversation

altafhusen-mr
Copy link
Contributor

No description provided.

altafhusen-mr and others added 20 commits May 3, 2020 17:50
Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
Co-authored-by: Altafhusen
<57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Sourabh
<56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
…r clean up, RabbitMQ dependency code removal for DataGeneratorTest

Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
Co-authored-by: Sourabh<56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Altafhusen<57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
and Sending properties to DirectChannel

Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
for both DirectChannel and RabbitMQChannel, and code cleanup

Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
RabbitMQChannel

Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
Copy link
Contributor

@MichaelRoeder MichaelRoeder left a comment

Choose a reason for hiding this comment

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

The implementation mainly covers what we discussed. However, I am not sure whether it really fulfills all the functionality that is necessary. In any case, there are several things that need to be improved. Please have a look at the following points as well as the comments in the code.

  1. The files are not correctly formatted. Please follow the rules defined in the .editorconfig file.

  2. It seems like a lot of the "direct communication" classes are missing a lot of implementations. Several methods are simply empty although they should have a functionality.

  3. In several places, the error handling is not good. Instead of returning an error state (e.g., null), an object that is not helpful is returned and the occurred error is "hidden". This needs to be changed! I am not sure whether I found all of the faulty catch blocks so please double check them.

  4. Some package names are not really clear to me. Maybe you could move some of the classes:

org.hobbit.core.data.handlers.DataHandler
org.hobbit.core.data.handlers.DataReceiver
org.hobbit.core.data.handlers.DataSender
org.hobbit.core.components.commonchannel.CommonChannel

should be moved to

org.hobbit.core.com
org.hobbit.core.components.channel.Direct*

should be moved to

org.hobbit.core.com.java

return delivery.getBody();
}
return new byte[] {};
}
Copy link
Contributor

Choose a reason for hiding this comment

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

What exactly is that? Does it mean that the AbstractEvaluationModule does not work with a "direct" communication?

evalModule2EvalStoreQueue.channel.basicPublish("", evalModule2EvalStoreQueue.name, props, requestBody);
QueueingConsumer.Delivery delivery = consumer.nextDelivery();
props = new BasicProperties.Builder().deliveryMode(2).replyTo(getFactoryForIncomingDataQueues().getQueueName(this)).build();
getFactoryForOutgoingDataQueues().writeBytes(requestBody, "", getFactoryForOutgoingDataQueues().getQueueName(this), props);
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the creation of properties etc. be part of a different method? What happens if a "direct" communication is used?

incomingDataQueueFactory = new ChannelFactory().getChannel(isRabbitMQEnabled(),
"", connectionFactory);
outgoingDataQueuefactory = new ChannelFactory().getChannel(isRabbitMQEnabled(),
"", connectionFactory);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why there are three different instances of a ChannelFactory created? Why not simply create one and reuse it?

* @author altaf, sourabh, yamini, melisa
*
*/
public interface CommonChannel {
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to give it a name like Channel. It is unclear where the term common comes from.

In addition, Javadoc comments for the methods defined in this interface are missing.

* @author altaf, sourabh, yamini, melisa
*
*/
public class DirectCallback {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this a class? It should be either an interface or at least an abstract class.

clone.put(original);
original.rewind();
clone.flip();
return clone;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the cloning so complicated? You can get direct access to the byte array of the buffer, copy it and wrap it with a new buffer.

while(pipeChannel.getPipe().source().isOpen() &&
pipeChannel.getPipe().source().read(buffer) > 0){
threadPool.execute(new ProcessCallback(callback, clone(buffer), pipeChannel.getProps()));
buffer.clear();
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it be easier to execute buffer = ByteBuffer.allocate(1024); instead of cloning the buffer before clearing it?

--i;
}
return Arrays.copyOf(inputArray, i + 1);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is too complex. The method copies the complete array before creating a smaller array and copying the content into the smaller array. Apart from that, the search for the end does not make sense to me. What happens if the last bytes of the data are 0 ?

Please fix this method.

* @author altaf, sourabh, yamini, melisa
*
*/
public class ReadByteChannel extends DirectChannel implements Runnable{
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like this class is never used, or am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ReadByteChannel is used in readBytes() method of DirectChannel class.

.createDefaultRabbitQueue(generateSessionQueueName(queueName));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Copy link
Contributor

Choose a reason for hiding this comment

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

What about error handling? Here, the wrong object will be returned while the method should return null.

altafhusen-mr and others added 5 commits June 24, 2020 16:45
… Communication_channel_transparency

� Conflicts:
�	src/main/java/org/hobbit/core/components/AbstractComponent.java
Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
removal, Test class revert changes.

Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
Co-authored-by: Sourabh <56801226+sourabhpoddar404@users.noreply.github.com>
Co-authored-by: Altafhusen <57062112+altafhusen-mr@users.noreply.github.com>
Co-authored-by: Yamini <29372422+Yamini19@users.noreply.github.com>
Co-authored-by: Melissa <21376912+melissadas@users.noreply.github.com>
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.

4 participants