@@ -3,10 +3,10 @@ import { AlkemioClient, createConfigUsingEnvVars } from '@alkemio/client-lib';
3
3
4
4
import Documents , { DocumentType } from './documents' ;
5
5
import logger from './logger' ;
6
- import ingest from './ingest' ;
6
+ import ingest , { SpaceIngestionPurpose } from './ingest' ;
7
7
import generateDocument from './generate-document' ;
8
8
9
- export const main = async ( spaceId : string ) => {
9
+ export const main = async ( spaceId : string , purpose : SpaceIngestionPurpose ) => {
10
10
logger . info ( `Ingest invoked for space ${ spaceId } ` ) ;
11
11
const config = createConfigUsingEnvVars ( ) ;
12
12
const alkemioCliClient = new AlkemioClient ( config ) ;
@@ -68,7 +68,7 @@ export const main = async (spaceId: string) => {
68
68
) ;
69
69
}
70
70
}
71
- await ingest ( space . nameID , documents ) ;
71
+ await ingest ( space . nameID , documents , purpose ) ;
72
72
logger . info ( 'Space ingested.' ) ;
73
73
} ;
74
74
@@ -83,7 +83,7 @@ export const main = async (spaceId: string) => {
83
83
const connectionString = `amqp://${ RABBITMQ_USER } :${ RABBITMQ_PASSWORD } @${ RABBITMQ_HOST } :${ RABBITMQ_PORT } ` ;
84
84
85
85
const conn = await amqplib . connect ( connectionString ) ;
86
- const queue = RABBITMQ_QUEUE ?? 'virtual-contributor-added-to -space' ;
86
+ const queue = RABBITMQ_QUEUE ?? 'ingest -space' ;
87
87
88
88
const channel = await conn . createChannel ( ) ;
89
89
await channel . assertQueue ( queue ) ;
@@ -94,7 +94,7 @@ export const main = async (spaceId: string) => {
94
94
//maybe share them in a package
95
95
//publish a confifrmation
96
96
const decoded = JSON . parse ( JSON . parse ( msg . content . toString ( ) ) ) ;
97
- await main ( decoded . spaceId ) ;
97
+ await main ( decoded . spaceId , decoded . purpose ) ;
98
98
// add rety mechanism as well
99
99
channel . ack ( msg ) ;
100
100
} else {
0 commit comments