Skip to content

Commit

Permalink
Add file based payload for reply operation
Browse files Browse the repository at this point in the history
An advanced option to control printing visualization debug messages
  • Loading branch information
gvensan committed Feb 6, 2024
1 parent 137edcb commit d3423b8
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stm",
"version": "0.0.28",
"version": "0.0.29",
"description": "Solace Try-Me Command Line Tool",
"keywords": [
"solace",
Expand Down
2 changes: 1 addition & 1 deletion src/common/visualize-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class VisualizeClient {
options.dmqEligible && message.setDMQEligible(false);
options.messageId && message.setApplicationMessageId(options.messageId);
options.messageType && message.setApplicationMessageType('VISUALIZATION_EVENT');
Logger.logSuccess(`visualize message published to topic ${topicName}`)
if (options.traceVisualization) Logger.logSuccess(`visualize message published to topic ${topicName}`)
// Logger.printMessage(message.dump(0), message.getUserPropertyMap(), message.getBinaryAttachment(), options.outputMode);
session.send(message);
} catch (error:any) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/reply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const reply = async (

try {
await replier.connect();
replier.subscribe(options.topic, message, optionsSource.message === 'default');
replier.subscribe(options.topic, message, optionsSource.message === 'cli');
} catch (error:any) {
Logger.logError('exiting...')
process.exit(1)
Expand Down
1 change: 1 addition & 0 deletions src/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ declare global {
waitBeforeExit?: number
exitAfter?: number
outputMode?: string
traceVisualization?: boolean

// Help Examples
helpMore?: boolean
Expand Down
1 change: 1 addition & 0 deletions src/utils/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ export const defaultMessageReplyConfig:any = {

waitBeforeExit: 0,
exitAfter: 0,
traceVisualization: false,

command: 'reply',
name: 'reply',
Expand Down
2 changes: 2 additions & 0 deletions src/utils/instances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export class MessageClientOptionsEmpty implements StmConfigOptions, MessageConne
outputMode?: string | undefined
waitBeforeExit?: number | undefined;
exitAfter?: number | undefined
traceVisualization?: boolean | undefined;
helpMore?: boolean | undefined
visualization?: string | boolean | undefined
visualizationPort?: number | undefined
Expand Down Expand Up @@ -117,6 +118,7 @@ export class MessageClientOptionsEmpty implements StmConfigOptions, MessageConne
this.outputMode = ""
this.waitBeforeExit = 0;
this.exitAfter = 0
this.traceVisualization = false;
this.helpMore = false
this.visualization = false
this.visualizationPort = 0
Expand Down
4 changes: 4 additions & 0 deletions src/utils/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export const addSendOptions = (cmd: Command, advanced: boolean) => {
.addOption(new Option('--wait-before-exit <NUMBER>', chalk.whiteBright('[advanced] wait for the specified number of seconds before exiting')) .argParser(parseNumber) .hideHelp(true))
.addOption(new Option('--exit-after <NUMBER>', chalk.whiteBright('[advanced] exit the session after specified number of seconds')) .argParser(parseNumber) .hideHelp(true))
.addOption(new Option('--log-level <LEVEL>', chalk.whiteBright('[advanced] solace log level, one of values: FATAL, ERROR, WARN, INFO, DEBUG, TRACE')) .argParser(parseLogLevel) .default(defaultMessageConnectionConfig.logLevel) .hideHelp(!advanced))
.addOption(new Option('--trace-visualization [BOOLEAN]', chalk.whiteBright('[advanced] trace visualization events')) .argParser(parseBoolean) .default(defaultMessageConfig.traceVisualization) .hideHelp(true))

// publish options
.addOption(new Option(`\n/* ${chalk.whiteBright('PUBLISH SETTINGS')} */`) .hideHelp(!advanced))
Expand Down Expand Up @@ -161,6 +162,7 @@ export const addReceiveOptions = (cmd: Command, advanced: boolean) => {
.addOption(new Option('--reapply-subscriptions [BOOLEAN]', chalk.whiteBright('[advanced] reapply subscriptions upon calling on a disconnected session')) .argParser(parseBoolean) .default(defaultMessageConnectionConfig.reapplySubscriptions) .hideHelp(!advanced))
.addOption(new Option('--output-mode <MODE>', chalk.whiteBright('[advanced] message print mode: COMPACT, PRETTY, NONE')) .argParser(parseOutputMode) .default(defaultMessageConfig.outputMode) .hideHelp(!advanced))
.addOption(new Option('--log-level <LEVEL>', chalk.whiteBright('[advanced] solace log level, one of values: FATAL, ERROR, WARN, INFO, DEBUG, TRACE')) .argParser(parseLogLevel) .default(defaultMessageConnectionConfig.logLevel) .hideHelp(!advanced))
.addOption(new Option('--trace-visualization [BOOLEAN]', chalk.whiteBright('[advanced] trace visualization events')) .argParser(parseBoolean) .default(defaultMessageConfig.traceVisualization) .hideHelp(true))

// consumer options
.addOption(new Option('--acknowledge-mode <MODE>', chalk.whiteBright('[advanced] the acknowledgement mode - AUTO or CLIENT')) .argParser( parseReceiverAcknowledgeMode) .default(defaultMessageReceiveConfig.acknowledgeMode) .hideHelp(!advanced))
Expand Down Expand Up @@ -215,6 +217,7 @@ export const addRequestOptions = (cmd: Command, advanced: boolean) => {
.addOption(new Option('--wait-before-exit <NUMBER>', chalk.whiteBright('[advanced] wait for the specified number of seconds before exiting')) .argParser(parseNumber) .hideHelp(true))
.addOption(new Option('--exit-after <NUMBER>', chalk.whiteBright('[advanced] exit the session after specified number of seconds')) .argParser(parseNumber) .hideHelp(true))
.addOption(new Option('--log-level <LEVEL>', chalk.whiteBright('[advanced] solace log level, one of values: FATAL, ERROR, WARN, INFO, DEBUG, TRACE')) .argParser(parseLogLevel) .default(defaultMessageConnectionConfig.logLevel) .hideHelp(!advanced))
.addOption(new Option('--trace-visualization [BOOLEAN]', chalk.whiteBright('[advanced] trace visualization events')) .argParser(parseBoolean) .default(defaultMessageConfig.traceVisualization) .hideHelp(true))

// request options
.addOption(new Option(`\n/* ${chalk.whiteBright('REQUEST SETTINGS')} */`) .hideHelp(!advanced))
Expand Down Expand Up @@ -281,6 +284,7 @@ export const addReplyOptions = (cmd: Command, advanced: boolean) => {
.addOption(new Option('--generate-sequence-number [BOOLEAN]', chalk.whiteBright('[advanced] include sequence number on messages sent')) .argParser(parseBoolean) .default(defaultMessageConnectionConfig.generateSequenceNumber) .hideHelp(!advanced))
.addOption(new Option('--exit-after <NUMBER>', chalk.whiteBright('[advanced] exit the session after specified number of seconds')) .argParser(parseNumber) .hideHelp(true))
.addOption(new Option('--log-level <LEVEL>', chalk.whiteBright('[advanced] solace log level, one of values: FATAL, ERROR, WARN, INFO, DEBUG, TRACE')) .argParser(parseLogLevel) .default(defaultMessageConnectionConfig.logLevel) .hideHelp(!advanced))
.addOption(new Option('--trace-visualization [BOOLEAN]', chalk.whiteBright('[advanced] trace visualization events')) .argParser(parseBoolean) .default(defaultMessageConfig.traceVisualization) .hideHelp(true))

// publish options
.addOption(new Option(`\n/* ${chalk.whiteBright('REPLY SETTINGS')} */`) .hideHelp(!advanced))
Expand Down

0 comments on commit d3423b8

Please sign in to comment.