how to Pass the IBMMQ Queue/Topic name dynamically in JMS Admin - ibm-mq

I wanted to pass the queue or topic name dynamically inside the jms admin. any help is appreciated.
below is the what i am trying
export DYLD_LIBRARY_PATH=/opt/mqm/lib64
mkdir /tmp/jndi
cd /tmp
echo $'INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory\n
PROVIDER_URL=file:///tmp/jndi\n
SECURITY_AUTHENTICATION=none' > JMSAdmin.config
chmod -R 4777 /opt/mqm/java
cp /tmp/JMSAdmin.config /opt/mqm/java/bin/
cd /opt/mqm/java/bin/
./JMSAdmin
DEFINE QCF(mqqcf) QMGR(QM1) tran(client) chan(DEV.APP.SVRCONN) host(localhost) port(1415)
DEFINE Q($queueName) QUEUE($queueName) QMGR(QM1)
$queueName is what i am looking to pass dynamically

Related

Cloud Sql Instance Promote with using shell

I am trying to promote Cloud Sql Replica Instance to Primary while running script. At time one instance I can promote but I want to promote all available replicas to primary instance parallelly at the same time not one by one
please suggest correction in the script
#!/bin/bash
#Set preject variables
gcloud auth login
read -p 'Please provide Project ID for the project that your instance is located in:' project
gcloud config set project $project
#Make a temp directory and file to store the JSON output from Gcloud
mkdir tempFiles
touch tempFiles/instanceDetails.json
touch tempFiles/instanceDetails-dr.json
touch tempFiles/replica1.json
touch tempFiles/replica2.json
touch tempFiles/replica3.json
touch tempFiles/replica4.json
touch tempFiles/replica5.json
touch tempFiles/primaryReplacementReplica.json
#Prompt the user for the primary instance and target failover replica
##read -p 'Enter the primary Instance ID: ' primaryInstance
read -p 'Enter the Instance ID of the target replica: ' drInstance
read -p 'Enter the Instance ID of the target replica: ' drInstance2
#Pull all data from primary instance needed for scripting
echo "Pulling Data from your SQL instances..."
##echo $(gcloud sql instances describe $primaryInstance --format="json") > tempFiles/instanceDetails.json
echo $(gcloud sql instances describe $drInstance --format="json") > tempFiles/instanceDetails-dr.json
echo $(gcloud sql instances describe $drInstance --format="json") > tempFiles/instanceDetails-dr2.json
#ask user to confirm the action since it is irreversable
read -p 'You are attempting to failover from $primaryInstance in $primaryRegion to $drInstance in $drRegion. This is an irreversible action, please type Yes to proceed: ' acceptance
read -p 'You are attempting to failover from $primaryInstance in $primaryRegion to $drInstance2 in $drRegion. This is an irreversible action, please type Yes to proceed: ' acceptance
if [ "$acceptance" = "Yes" ]
then
#Promote the read replica in the DR region
echo "Promoting the replica to a standalone instance..."
gcloud sql instances promote-replica $drInstance && gcloud sql instances promote-replica $drInstance2
echo "Instance promoted."
else
echo "You did not confirm with a Yes. No changes have been made."
fi

how to load array parameter in another shell file dynamically over ssh connection

I need to call my executable which is placed in an on-prem server by using an ssh connection and pass a dynamics parameter.
based on my requirement, users should be able to add or remove parameters as they want to work with the executable on the on-prem server.
I wrote a translator to identify any new parameter added to the console but now when I want to pass it via ssh, I am facing 2 problems.
what if I have a value that contains space?
how to load these values dynamically & use them as arguments on my shell script on the server?
**Also take note that I am sending some additional parameters that are not related to my executable argument but I need them as well.
params=(
"$MASTER"
"$NAME"
"$QUEUE"
service.enabled=true
)
for var_name in "${!conf__#}";
do
key=${var_name#conf__};
key=${key//_/.};
value=${!var_name};
params+=( --conf "$key=$value" );
done
echo "${params[#]}"
ssh -o StrictHostKeyChecking=no myuser#server_ip "/bin/bash -s" < deploy_script.sh "${params[#]}"
My deploy_script.sh file will be something like the below file.
#!/bin/bash
set -e
AR_MASTER=${1}
AR_NAME=${2}
AR_QUEUE=${3}
AR_SER_EN=${4}
# How can I get the other dynamic parameters???
main() {
my-executable \
"--master "$AR_MASTER \
"--name "$AR_NAME \
"--queue "$AR_QUEUE \
"--conf service.enabled="$AR_SER_EN \
??? #how to add the additional configuration dynamically?
}
main "$#"
Would you mind help me in figure it out?

'composer identity issue ...' does not give any output

I have created an angular application using composer and yeoman where transactions are happening correctly. Now I want to add users with different operational roles. I have added details in the permission file and created participants accordingly.
percmissions.acl looks like:
rule Govt {
description: "Allow all participants access to all resources"
participant: "org.acme.<network-name>.Govt"
operation: ALL
resource: "org.acme.<network-name>.*"
action: ALLOW
}
rule Farmer {
description: "Allow all participants access to all resources"
participant: "org.acme.<network-name>.Farmer"
operation: READ
resource: "org.acme.<network-name>.*"
action: ALLOW
}
rule SystemACL {
description: "System ACL to permit all access"
participant: "org.hyperledger.composer.system.Participant"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}
Participants 'govt1' and 'farmer1' are successfully added as suggested in https://hyperledger.github.io/composer/managing/participant-add.html
To issue identity, I run the command:
composer identity issue -p hlfv1 -n ‘<networkname>’ -i admin -s adminpw -u govt1id1 -a "resource:org.acme.cphnetwork.Govt#govt1”
The issue is that the command does not give any output.. neither success nor error.
on q1. You can use the --issuer, -x flag on composer identity issue command to create an identity (associated with a participant) that will also have 'issuer' authority -> https://hyperledger.github.io/composer/reference/composer.identity.issue.html … on q2. Your playground would need to be connected via a v1 connection profile (and then you would need to connect to that deployed business network in playground) to the same runtime fabric where you originally deployed your business network (which your REST APIs are consuming via rest-server)
To address the original question, as per discussion on rocketchat:
Original command:
composer identity issue -p hlfv1 -n ‘<networkname>’ -i admin -s adminpw -u govt1id1 -a "resource:org.acme.cphnetwork.Govt#govt1”
Solution:
Remove the 'single quotes' from the <networkname>
Remove the word 'resource:'
Remove "double quotes" from namespace#participant
So if the business network name is govt-application, the command should look like:
composer identity issue -p hlfv1 -n govt-application -i admin -s adminpw -u govt1id1 -a org.acme.cphnetwork.Govt#govt1
As per discussion on rocketchat, simply removing the word 'resouce:' and retaining the quotes also works.

Consuming function module with SAP Netweaver RFC SDK in Bash

I'm trying to make a request to a function in a SAP RFC server hosted at 10.123.231.123 with user myuser, password mypass, sysnr 00, client 076, language E. The name of the function is My_Function_Nm with params: string Alternative, string Date, string Name.
I use the command line:
/usr/sap/nwrfcsdk/bin/startrfc -h 10.123.231.123 -s 00 -u myuser -p mypass -c 076 -l en -F My_Function_Nm
But it always shows me the help instructions.
I guess I'm not specifying the -E pathname=edifile, and it's because i don't know how to create a EDI File to include the parameters values to the specified function. Maybe someone can help me on how to create this file and how to correctly invoke startrfc to consume from this function?
Thanks in advance.
If you actually check the help text the problem shows, you should find the following passages:
RFC connection options:
[...]
-2 SNA mode on.
You must set this if you want to connect to R/2.
[...]
-3 R/3 mode on.
You must set this if you want to connect to R/3.
Apparently you forgot to specify -3...
You should use sapnwrfc.ini which will store your connection parameters, and it should be places in the same directory as client program.
Sample file for your app should be following:
DEST=TST1
ASHOST=10.123.231.123
USER=myuser
PASSWD=mypass
SYSNR=076
RFC_TRACE=0
Documentation on using this file is here.
For calling the function you must create Bash-script, but better to use Python script.

Apache Thrift 0.9.1 generate golang code , param -r don't work

I use
`thrift-0.9.1 -r -gen go aaa.thrift`
to generate golang code
(note: aaa.thrfit include bbb.thrift which defined "Body" struct)
the param -r seems doesn't work, can't find "Body" struct in ttypes.go,
but when I try to use
`thrift-0.9.1 -r -gen java aaa.thrift`
has "Body.java",
how can I generate golang code which included files?
(note:from https://github.com/apache/thrift)
I know the reason, namespace go service.demo lead to the problem
$ cd thrift
$ cd trunk
$ cd tutorial
$ thrift -r -gen go tutorial.thrift
works perfectly for me.

Resources