Bug de correlation_id undefined
This commit is contained in:
@@ -15,7 +15,7 @@ params:query {
|
||||
}
|
||||
|
||||
body:form-urlencoded {
|
||||
iccid: 8933201125068886700
|
||||
iccid: 8935103196306448300
|
||||
}
|
||||
|
||||
settings {
|
||||
|
||||
@@ -11,7 +11,7 @@ post {
|
||||
}
|
||||
|
||||
body:form-urlencoded {
|
||||
iccid: 8933201125065160380
|
||||
iccid: 8935103196306448300
|
||||
~offer: SAVEFAMILY1
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"test": "vitest watch",
|
||||
"build": "rm -rf ./dist && yarn workspaces foreach -Api run build && cp .env dist/ && yarn setup:runtime",
|
||||
"setup:runtime": "mkdir -p dist/packages/node_modules && ln -sf ../sim-shared dist/packages/node_modules/sim-shared && ln -sf ../sf-consumidor-objenious dist/packages/node_modules/sim-consumidor-objenious",
|
||||
"start": "yarn setup:runtime && yarn workspaces foreach -Apiv --exclude sim-objenious-cron run start",
|
||||
"start": "yarn setup:runtime && yarn workspaces foreach -Apiv run start",
|
||||
"typecheck": "npx tsc --noEmit",
|
||||
"dev": "yarn workspaces foreach -Apiv --exclude sim-objenious-cron run dev",
|
||||
"lint": "eslint .",
|
||||
|
||||
@@ -51,7 +51,7 @@ export class SimNosController {
|
||||
await this.eventBus.ack(msg)
|
||||
return result
|
||||
} else {
|
||||
console.error("Error general procesando el caso de uso (NOS)", result.error)
|
||||
console.error("Error procesando el caso de uso (NOS)", result.error)
|
||||
this.eventBus.nack(msg)
|
||||
return result
|
||||
}
|
||||
@@ -66,7 +66,7 @@ export class SimNosController {
|
||||
|
||||
public activate() {
|
||||
return async (msg: ConsumeMessage) => {
|
||||
console.log("[i] Evento activate ", msg)
|
||||
console.log("[i] Evento activate ", msg.fields)
|
||||
const data = this.validateMsg(msg) as SimEvents.activation
|
||||
const iccid = data.payload.iccid
|
||||
const correlation_id = data.headers?.message_id
|
||||
@@ -81,11 +81,13 @@ export class SimNosController {
|
||||
|
||||
public suspend() {
|
||||
return async (msg: ConsumeMessage) => {
|
||||
console.log("Evento suspend ", msg)
|
||||
console.log("Evento suspend ", msg.fields)
|
||||
const data = this.validateMsg(msg) as SimEvents.suspend
|
||||
const iccid = data.payload.iccid
|
||||
const correlation_id = data.headers?.message_id
|
||||
const res = await this.tryUseCase(msg, this.uscases.suspend({
|
||||
iccid: iccid
|
||||
iccid: iccid,
|
||||
correlation_id: correlation_id
|
||||
}))
|
||||
|
||||
return res;
|
||||
@@ -94,17 +96,19 @@ export class SimNosController {
|
||||
|
||||
public terminate() {
|
||||
return async (msg: ConsumeMessage) => {
|
||||
console.log("Evento termiante no soportado ", msg)
|
||||
console.log("Evento termiante no soportado ", msg.fields)
|
||||
}
|
||||
}
|
||||
|
||||
public reActivate() {
|
||||
return async (msg: ConsumeMessage) => {
|
||||
console.log("Evento reActivate ", msg)
|
||||
console.log("Evento reActivate ", msg.fields)
|
||||
const data = this.validateMsg(msg) as SimEvents.reActivation
|
||||
const iccid = data.payload.iccid
|
||||
const correlation_id = data.headers?.message_id
|
||||
const res = await this.tryUseCase(msg, this.uscases.reactivate({
|
||||
iccid: iccid
|
||||
iccid: iccid,
|
||||
correlation_id: correlation_id
|
||||
}))
|
||||
|
||||
return res;
|
||||
|
||||
@@ -53,7 +53,10 @@ export class SimNosUsecases {
|
||||
error: reason,
|
||||
stackTrace: detail
|
||||
}
|
||||
|
||||
console.log("SET FAILED DATA:", updateData)
|
||||
const order = await this.orderRepository.errorOrder(updateData)
|
||||
console.log("SET FAILED RES:", order)
|
||||
return order
|
||||
}
|
||||
|
||||
@@ -73,9 +76,11 @@ export class SimNosUsecases {
|
||||
const res = await func(args)
|
||||
|
||||
if (res.error != undefined) {
|
||||
console.log("Error peticion: ", res)
|
||||
console.log("Error peticion: ", res, correlation_id)
|
||||
if (correlation_id != undefined)
|
||||
this.setFailed(correlation_id, res.error).then()
|
||||
this.setFailed(correlation_id, res.error)
|
||||
.then(e => console.log("failed", e))
|
||||
.catch(e => console.error(e))
|
||||
return res;
|
||||
} else {
|
||||
if (correlation_id != undefined)
|
||||
@@ -98,21 +103,24 @@ export class SimNosUsecases {
|
||||
iccid: string,
|
||||
correlation_id?: string
|
||||
}) {
|
||||
return this.usecaseTemplate((args) => this.nosRepository.activateSim(args), args.iccid, args.correlation_id)
|
||||
return this.usecaseTemplate(
|
||||
(args) => this.nosRepository.activateSim(args), args.iccid, args.correlation_id)
|
||||
}
|
||||
|
||||
public suspend(args: {
|
||||
iccid: string,
|
||||
correlation_id?: string
|
||||
}) {
|
||||
return this.usecaseTemplate(this.nosRepository.bar, args.iccid, args.correlation_id)
|
||||
return this.usecaseTemplate(
|
||||
(args) => this.nosRepository.bar(args), args.iccid, args.correlation_id)
|
||||
}
|
||||
|
||||
public reactivate(args: {
|
||||
iccid: string,
|
||||
correlation_id?: string
|
||||
}) {
|
||||
return this.usecaseTemplate(this.nosRepository.unbar, args.iccid, args.correlation_id)
|
||||
return this.usecaseTemplate(
|
||||
(args) => this.nosRepository.unbar(args), args.iccid, args.correlation_id)
|
||||
}
|
||||
|
||||
public terminate(args: { iccid: string }) {
|
||||
|
||||
@@ -34,7 +34,7 @@ const EXCHANGES = {
|
||||
export const rabbitmqEventBus = new RabbitMQEventBus({
|
||||
connectionParams: rmqConnOptions,
|
||||
buildStructure: buildQueues,
|
||||
maxRetry: 5,
|
||||
maxRetry: 2,
|
||||
delayedExchange: EXCHANGES.DEL,
|
||||
dlxExchange: EXCHANGES.DLX
|
||||
})
|
||||
|
||||
@@ -380,7 +380,7 @@ export class OrderRepository {
|
||||
|
||||
const id = currentOrderResult.data.id // Saco el id para evitar busacr por correlation_id que es mas lento
|
||||
const currentOrder = currentOrderResult.data!
|
||||
console.log("Current Order", currentOrder)
|
||||
//console.log("Current Order", currentOrder)
|
||||
|
||||
// 3. Si todo ok se actualiza el order
|
||||
// Si el status es dlx se asume que ha terminado y no va a reintentarse
|
||||
|
||||
Reference in New Issue
Block a user