To use this function add it to the class library file named OrchestratorService.ts
GitHub Repository: https://github.com/SimonSparksUK/Orchestrator
Filename: OrchestratorService.ts
Description: Orchestrator Function to Create an AMQP Subscription
Function AMQPSubscriptionCreate
publicAMQPSubscriptionCreate(strName:string,strFQDN:string,strUsername:string,strPassword:string,strExchangeName:string,strQueueName:string,strSubscriptionName:string):AMQPSubscription{
letobjPropertiesAMQPBroker:any={
host:strFQDN,
port:5672,
username:strUsername,
password:strPassword,
virtualHost:"/",
useSSL:true,
acceptAllCertificates:true,
name:strName
};
letobjPropertiesAMQPExchange:any={
type:"topic",
durable:true,
autoDelete:false
};
letobjPropertiesAMQPQueue:any={
durable:true,
exclusive:false,
autoDelete:false
};
letobjPropertiesAMQPSubscription:any={
name:strSubscriptionName
};
letarrQueue:string[]= [strQueueName];
letobjAMQPBroker:AMQPBroker=AMQPBrokerManager.addBroker(objPropertiesAMQPBroker);
objAMQPBroker.validate();
objAMQPBroker.declareExchange(strExchangeName,objPropertiesAMQPExchange);
objAMQPBroker.declareQueue(strQueueName,objPropertiesAMQPQueue);
objAMQPBroker.bind(strQueueName,strExchangeName,{routingKey:"#"});
letobjAMQPSubscription:AMQPSubscription=objAMQPBroker.subscribe(arrQueue,objPropertiesAMQPSubscription);
returnobjAMQPSubscription;
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
