I have my code working fine.. The idea is very simple: I am sending data to my messaging queue via either of those three QueuePolicy
implementations. It depends on how clients want to send data. As of now I am passing implementation of QueuePolicy
in the Packet
constructor and then sends data via that policy. Each QueuePolicy
implementation calls corresponding method in SendRecord
class.
I have my code working fine. The idea is very simple: I am sending data to my messaging queue via either of those three QueuePolicy
implementations. It depends on how clients want to send data. As of now I am passing implementation of QueuePolicy
in the Packet
constructor and then sends data via that policy. Each QueuePolicy
implementation calls corresponding method in SendRecord
class.
I have my code working fine.. The idea is very simple: I am sending data to my messaging queue via either of those three QueuePolicy
implementations. It depends on how clients want to send data. As of now I am passing implementation of QueuePolicy
in the Packet
constructor and then sends data via that policy. Each QueuePolicy
implementation calls corresponding method in SendRecord
class.
For each partition, I have bunch of dataHolders
so I am iterating those and then sending it to my messaging queue:-
For each partition, I have bunch of dataHolders
so I am iterating those and then sending it to my messaging queue:
For each partition, I have bunch of dataHolders
so I am iterating those and then sending it to my messaging queue:-
send Send records to messaging queue using either of one policy
I have bunch of keys (clientKeyclientKey
) and values (processBytesprocessBytes
) that I want to send to our messaging queue by packing them in one byte array. I will make one byte array of all the keys and values which should always be less than 50K and then send to our messaging queue.
For each partition, I have bunch of "dataHolders"dataHolders
so I am iterating those and then sending it to my messaging queue as shown below:
PacketPacket
class: This class packs all the keys and values into one byte array and call corresponding implementation passed in the constructor to send data to queue.
Now I can send data to my messaging queue in three different ways so for that I created an interface and then having three different implementations as shown below.:
QueuePolicyQueuePolicy
interface:
QPolicyAsyncQPolicyAsync
class:
QPolicySyncQPolicySync
class:
QPolicySyncWithSocketQPolicySyncWithSocket
class:
SendRecordSendRecord
class: This is the actual class which sends data to my messaging queue. It has three different implementations (numbered with 1, 2, 3 as comments) in it and each of those implementations is being called from above "QueuePolicy"QueuePolicy
implementations:
I have my above code working fine. Idea is very simple, I am sending data to my messaging queue via either of those three "QueuePolicy" implementations. It depends on how clients want to send data. As of now I am passing implementation of "QueuePolicy" in the "Packet" constructor and then sends data via that policy. Each "QueuePolicy" implementation calls corresponding method in "SendRecord" class.
I have my code working fine. The idea is very simple: I am sending data to my messaging queue via either of those three QueuePolicy
implementations. It depends on how clients want to send data. As of now I am passing implementation of QueuePolicy
in the Packet
constructor and then sends data via that policy. Each QueuePolicy
implementation calls corresponding method in SendRecord
class.
- Does my "Packet"
Packet
class needs to know on how data is being sent? I think "Packet"Packet
class is just a container, and that's all it is. I think we shouldn't expect it to know how to transmit itself. A transmitter does that. - Also, each "QueuePolicy"
QueuePolicy
implementation calls corresponding method of "SendRecord"SendRecord
class. Is this really needed or there is any better way? Can we not get rid of "SendRecord"SendRecord
class and have them implemented in each of these three "QueuePolicy"QueuePolicy
implementations?
I believe with my above design, I might be breaking Single responsibility principleResponsibility Principle or not following oops standard properly so wanted to see if we can design this efficiently and if there is any better way? What is the best way by which we can send key[s]key(s) and value[s]value(s) by packing them in one byte array (following that 50K limit) either through sync or async mode?
send records to messaging queue using either of one policy
I have bunch of keys (clientKey) and values (processBytes) that I want to send to our messaging queue by packing them in one byte array. I will make one byte array of all the keys and values which should always be less than 50K and then send to our messaging queue.
For each partition, I have bunch of "dataHolders" so I am iterating those and then sending it to my messaging queue as shown below:
Packet class: This class packs all the keys and values into one byte array and call corresponding implementation passed in the constructor to send data to queue.
Now I can send data to my messaging queue in three different ways so for that I created an interface and then having three different implementations as shown below.
QueuePolicy interface:
QPolicyAsync class:
QPolicySync class:
QPolicySyncWithSocket class:
SendRecord class: This is the actual class which sends data to my messaging queue. It has three different implementations (numbered with 1, 2, 3 as comments) in it and each of those implementations is being called from above "QueuePolicy" implementations:
I have my above code working fine. Idea is very simple, I am sending data to my messaging queue via either of those three "QueuePolicy" implementations. It depends on how clients want to send data. As of now I am passing implementation of "QueuePolicy" in the "Packet" constructor and then sends data via that policy. Each "QueuePolicy" implementation calls corresponding method in "SendRecord" class.
- Does my "Packet" class needs to know on how data is being sent? I think "Packet" class is just a container, and that's all it is. I think we shouldn't expect it to know how to transmit itself. A transmitter does that.
- Also each "QueuePolicy" implementation calls corresponding method of "SendRecord" class. Is this really needed or there is any better way? Can we not get rid of "SendRecord" class and have them implemented in each of these three "QueuePolicy" implementations?
I believe with my above design, I might be breaking Single responsibility principle or not following oops standard properly so wanted to see if we can design this efficiently and if there is any better way? What is the best way by which we can send key[s] and value[s] by packing them in one byte array (following that 50K limit) either through sync or async mode?
Send records to messaging queue using either of one policy
I have bunch of keys (clientKey
) and values (processBytes
) that I want to send to our messaging queue by packing them in one byte array. I will make one byte array of all the keys and values which should always be less than 50K and then send to our messaging queue.
For each partition, I have bunch of dataHolders
so I am iterating those and then sending it to my messaging queue:
Packet
class: This class packs all the keys and values into one byte array and call corresponding implementation passed in the constructor to send data to queue.
Now I can send data to my messaging queue in three different ways so for that I created an interface and then having three different implementations:
QueuePolicy
interface:
QPolicyAsync
class:
QPolicySync
class:
QPolicySyncWithSocket
class:
SendRecord
class: This is the actual class which sends data to my messaging queue. It has three different implementations (numbered with 1, 2, 3 as comments) in it and each of those implementations is being called from above QueuePolicy
implementations:
I have my code working fine. The idea is very simple: I am sending data to my messaging queue via either of those three QueuePolicy
implementations. It depends on how clients want to send data. As of now I am passing implementation of QueuePolicy
in the Packet
constructor and then sends data via that policy. Each QueuePolicy
implementation calls corresponding method in SendRecord
class.
- Does my
Packet
class needs to know on how data is being sent? I thinkPacket
class is just a container, and that's all it is. I think we shouldn't expect it to know how to transmit itself. A transmitter does that. - Also, each
QueuePolicy
implementation calls corresponding method ofSendRecord
class. Is this really needed or there is any better way? Can we not get rid ofSendRecord
class and have them implemented in each of these threeQueuePolicy
implementations?
I believe with my design, I might be breaking Single Responsibility Principle or not following oops standard properly so wanted to see if we can design this efficiently and if there is any better way? What is the best way by which we can send key(s) and value(s) by packing them in one byte array (following that 50K limit) either through sync or async mode?