Skip to content

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

stutiuneyal
Copy link
Contributor

No description provided.

@chughts chughts self-requested a review July 4, 2025 10:40
Copy link
Collaborator

@chughts chughts left a 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) {
Copy link
Collaborator

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.

Copy link
Contributor Author

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?

@stutiuneyal stutiuneyal requested a review from chughts July 9, 2025 20:25
Copy link
Collaborator

@chughts chughts left a 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++) {
Copy link
Collaborator

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();
Copy link
Collaborator

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);
Copy link
Collaborator

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.

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.

2 participants