-
Notifications
You must be signed in to change notification settings - Fork 178
Add base java samples #316
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
base: master
Are you sure you want to change the base?
Add base java samples #316
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
800 lines of code, mostly repeated that can be condensed down to no more than 200 lines of code.
The feedback for BasicGet
equally applies to the rest of the modules.
} | ||
} | ||
|
||
} catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
best to have a common method - in base class - to handle the displaying of exceptions, so can show nested exceptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please elaborate a bit more on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The basic pattern for each sample needs to be
Construct - create connection, determination configuration
Action - repeat as many times as needed
Close - close the connection.
The patterns use multiple entries in the env.json, in the producer to create a connection string. The underlying MQ code then makes the connection to an available endpoint.
int length = envSetter.getDetails().size(); | ||
System.out.println("Total MQ endpoints: " + length); | ||
|
||
for (int i = 0; i < length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to send a message to every queue manager / queue listed as an endpoint. If the env.json
file contains multiple endpoints. Then for put - the code should build a connection string. For get - it drains from each entrypoint.
public class BasicGet { | ||
|
||
public static void main(String[] args) { | ||
BasicConsumerWrapper wrapper = new BasicConsumerWrapper(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The construct in the mains should be
construct - creates the connection
action - put / get / pub / sub etc
close - closes the connection
to emphasise that the connection create / close is time consuming and should be performed once for multiple actions.
System.out.println(length); | ||
|
||
for (int i = 0; i < length; i++) { | ||
MQDetails details = envSetter.getDetails().get(i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will send a request to each endpoint listed. - should be using the entries to construct a connection string.
No description provided.