diff --git a/arangodb-foxx-api/src/main/scala/za/co/absa/spline/consumer/service/model/ExecutionPlanInfo.scala b/arangodb-foxx-api/src/main/scala/za/co/absa/spline/consumer/service/model/ExecutionPlanInfo.scala index d5fad7441..8681edd5d 100644 --- a/arangodb-foxx-api/src/main/scala/za/co/absa/spline/consumer/service/model/ExecutionPlanInfo.scala +++ b/arangodb-foxx-api/src/main/scala/za/co/absa/spline/consumer/service/model/ExecutionPlanInfo.scala @@ -16,11 +16,11 @@ package za.co.absa.spline.consumer.service.model -import java.util.UUID - import io.swagger.annotations.{ApiModel, ApiModelProperty} import za.co.absa.spline.consumer.service.model.ExecutionPlanInfo.Id +import java.util.UUID + @ApiModel(description = "Execution plan information") case class ExecutionPlanInfo ( diff --git a/arangodb-foxx-services/src/main/routes/admin-router.ts b/arangodb-foxx-services/src/main/routes/admin/admin-router.ts similarity index 95% rename from arangodb-foxx-services/src/main/routes/admin-router.ts rename to arangodb-foxx-services/src/main/routes/admin/admin-router.ts index 31dd7eccc..cea264ce4 100644 --- a/arangodb-foxx-services/src/main/routes/admin-router.ts +++ b/arangodb-foxx-services/src/main/routes/admin/admin-router.ts @@ -16,7 +16,7 @@ import { createRouter } from '@arangodb/foxx' import joi from 'joi' -import { pruneBefore } from '../services/prune-database' +import { pruneBefore } from '../../services/prune-database' export const adminRouter = createRouter() diff --git a/arangodb-foxx-services/src/main/routes/admin/index.ts b/arangodb-foxx-services/src/main/routes/admin/index.ts new file mode 100644 index 000000000..ef3caa64a --- /dev/null +++ b/arangodb-foxx-services/src/main/routes/admin/index.ts @@ -0,0 +1,20 @@ +/* + * Copyright 2022 ABSA Group Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { adminRouter } from './admin-router' + + +export default adminRouter diff --git a/arangodb-foxx-services/src/main/routes/events-router.ts b/arangodb-foxx-services/src/main/routes/consumer/events-router.ts similarity index 69% rename from arangodb-foxx-services/src/main/routes/events-router.ts rename to arangodb-foxx-services/src/main/routes/consumer/events-router.ts index 2475a6445..0a907f71d 100644 --- a/arangodb-foxx-services/src/main/routes/events-router.ts +++ b/arangodb-foxx-services/src/main/routes/consumer/events-router.ts @@ -17,33 +17,16 @@ import { createRouter } from '@arangodb/foxx' import Joi from 'joi' -import { lineageOverview } from '../services/lineage-overview' -import { impactOverview } from '../services/impact-overview' -import { Progress } from '../../external/persistence-api.model' -import { - checkExecutionEventExists, - listExecutionEventInfo_groupedByDataSource, - listExecutionEvents, - storeExecutionEvent -} from '../services/execution-event-store' +import { lineageOverview } from '../../services/lineage-overview' +import { impactOverview } from '../../services/impact-overview' +import { listExecutionEventInfo_groupedByDataSource, listExecutionEvents } from '../../services/execution-event-store' +import { LineageOverview } from '../../model' +import { ExecutionEventInfo, Frame } from '../../../external/consumer-api.model' export const eventsRouter: Foxx.Router = createRouter() -// Store execution event -eventsRouter - .post('/', - (req: Foxx.Request, res: Foxx.Response) => { - const execEvent: Progress = req.body - storeExecutionEvent(execEvent) - res.status('created') - }) - .body(['application/json'], 'Execution Event (Progress) JSON') - .response(201, 'Execution event recorded') - .summary('Record a new execution event') - - // List execution events eventsRouter .get('/', @@ -89,21 +72,22 @@ eventsRouter eventsRouter .get('/_grouped-by-ds', (req: Foxx.Request, res: Foxx.Response) => { - const events = listExecutionEventInfo_groupedByDataSource( - req.queryParams.asAtTime, - req.queryParams.timestampStart, - req.queryParams.timestampEnd, - req.queryParams.searchTerm, - req.queryParams.writeAppends, - req.queryParams.includeNoWrite, - req.queryParams.applicationId, - req.queryParams.dataSourceUri, - req.queryParams.labels, - req.queryParams.sortField, - req.queryParams.sortOrder, - req.queryParams.offset, - req.queryParams.limit, - ) + const events: Frame> = + listExecutionEventInfo_groupedByDataSource( + req.queryParams.asAtTime, + req.queryParams.timestampStart, + req.queryParams.timestampEnd, + req.queryParams.searchTerm, + req.queryParams.writeAppends, + req.queryParams.includeNoWrite, + req.queryParams.applicationId, + req.queryParams.dataSourceUri, + req.queryParams.labels, + req.queryParams.sortField, + req.queryParams.sortOrder, + req.queryParams.offset, + req.queryParams.limit, + ) res.send(events) }) .queryParam('asAtTime', Joi.number().required()) @@ -128,29 +112,13 @@ eventsRouter .summary('List execution events') -// Check if execution event exists -eventsRouter - .get('/:eventId/_exists', - (req: Foxx.Request, res: Foxx.Response) => { - const exists = checkExecutionEventExists( - req.pathParams.eventId, - req.queryParams.discriminator - ) - res.send(exists) - }) - .pathParam('eventId', Joi.string().min(1).required(), 'Execution Event ID') - .queryParam('discriminator', Joi.string().optional(), 'Execution Event Discriminator') - .response(200, ['application/json'], 'Boolean value indicating if the execution event exists') - .summary('Check if the execution event with the given parameters exists') - - // Get execution event lineage overview eventsRouter .get('/:eventKey/lineage-overview/:maxDepth', (req: Foxx.Request, res: Foxx.Response) => { - const eventKey = req.pathParams.eventKey - const maxDepth = req.pathParams.maxDepth - const overview = lineageOverview(eventKey, maxDepth) + const eventKey: string = req.pathParams.eventKey + const maxDepth: number = req.pathParams.maxDepth + const overview: LineageOverview = lineageOverview(eventKey, maxDepth) if (overview) { res.send(overview) } @@ -170,9 +138,9 @@ eventsRouter eventsRouter .get('/:eventKey/impact-overview/:maxDepth', (req: Foxx.Request, res: Foxx.Response) => { - const eventKey = req.pathParams.eventKey - const maxDepth = req.pathParams.maxDepth - const overview = impactOverview(eventKey, maxDepth) + const eventKey: string = req.pathParams.eventKey + const maxDepth: number = req.pathParams.maxDepth + const overview: LineageOverview = impactOverview(eventKey, maxDepth) if (overview) { res.send(overview) } diff --git a/arangodb-foxx-services/src/main/routes/consumer/index.ts b/arangodb-foxx-services/src/main/routes/consumer/index.ts new file mode 100644 index 000000000..889141d1f --- /dev/null +++ b/arangodb-foxx-services/src/main/routes/consumer/index.ts @@ -0,0 +1,30 @@ +/* + * Copyright 2022 ABSA Group Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { createRouter } from '@arangodb/foxx' + +import { plansRouter } from './plans-router' +import { eventsRouter } from './events-router' +import { operationsRouter } from './operations-router' + + +const consumerRouter: Foxx.Router = createRouter() + +consumerRouter.use('/execution-plans', plansRouter) +consumerRouter.use('/execution-events', eventsRouter) +consumerRouter.use('/operations', operationsRouter) + +export default consumerRouter diff --git a/arangodb-foxx-services/src/main/routes/operations-router.ts b/arangodb-foxx-services/src/main/routes/consumer/operations-router.ts similarity index 87% rename from arangodb-foxx-services/src/main/routes/operations-router.ts rename to arangodb-foxx-services/src/main/routes/consumer/operations-router.ts index c2a527286..3e24a3947 100644 --- a/arangodb-foxx-services/src/main/routes/operations-router.ts +++ b/arangodb-foxx-services/src/main/routes/consumer/operations-router.ts @@ -16,9 +16,9 @@ import { createRouter } from '@arangodb/foxx' import Joi from 'joi' -import { getOperationById } from '../services/operation-store' -import { ExpressionGraph, OperationDetails } from '../../external/consumer-api.model' -import { expressionGraphUsedByOperation } from '../services/expressions-store' +import { getOperationById } from '../../services/operation-store' +import { ExpressionGraph, OperationDetails } from '../../../external/consumer-api.model' +import { expressionGraphUsedByOperation } from '../../services/expressions-store' export const operationsRouter: Foxx.Router = createRouter() diff --git a/arangodb-foxx-services/src/main/routes/consumer/plans-router.ts b/arangodb-foxx-services/src/main/routes/consumer/plans-router.ts new file mode 100644 index 000000000..ba9fa512b --- /dev/null +++ b/arangodb-foxx-services/src/main/routes/consumer/plans-router.ts @@ -0,0 +1,37 @@ +/* + * Copyright 2022 ABSA Group Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { createRouter } from '@arangodb/foxx' +import { DataSourceActionType } from '../../../external/consumer-api.model' +import { getDataSourceURIsByActionType } from '../../services/execution-plan-store' +import Joi from 'joi' + + +export const plansRouter: Foxx.Router = createRouter() + + +plansRouter + .get('/:planId/data-sources', + (req: Foxx.Request, res: Foxx.Response) => { + const uris: string[] = getDataSourceURIsByActionType( + req.pathParams.planId, + req.queryParams.access + ) + res.send(uris) + }) + .pathParam('planId', Joi.string().min(1).required(), 'Execution Plan ID') + .queryParam('access', Joi.string().optional().valid(DataSourceActionType.values).default(null), 'Access type (read/write) to filter by') + .response(200, ['application/json'], 'Array of data source URIs') diff --git a/arangodb-foxx-services/src/main/routes/index.ts b/arangodb-foxx-services/src/main/routes/index.ts index 0f10b38d7..45e6e5c48 100644 --- a/arangodb-foxx-services/src/main/routes/index.ts +++ b/arangodb-foxx-services/src/main/routes/index.ts @@ -17,12 +17,10 @@ import { createRouter } from '@arangodb/foxx' import { context } from '@arangodb/locals' -import { adminRouter } from './admin-router' -import { plansRouter } from './plans-router' -import { eventsRouter } from './events-router' -import { dsRouter } from './data-sources-router' -import { operationsRouter } from './operations-router' import { RequestLogger } from '../middleware/request-logger.middleware' +import adminRouter from './admin' +import producerRouter from './producer' +import consumerRouter from './consumer' const rootRouter: Foxx.Router = createRouter() @@ -32,9 +30,7 @@ if (context.isDevelopment) { } rootRouter.use('/admin', adminRouter) -rootRouter.use('/execution-plans', plansRouter) -rootRouter.use('/execution-events', eventsRouter) -rootRouter.use('/data-sources', dsRouter) -rootRouter.use('/operations', operationsRouter) +rootRouter.use('/producer', producerRouter) +rootRouter.use('/consumer', consumerRouter) export default rootRouter diff --git a/arangodb-foxx-services/src/main/routes/data-sources-router.ts b/arangodb-foxx-services/src/main/routes/producer/data-sources-router.ts similarity index 89% rename from arangodb-foxx-services/src/main/routes/data-sources-router.ts rename to arangodb-foxx-services/src/main/routes/producer/data-sources-router.ts index 83e8e74e1..3c3c755e5 100644 --- a/arangodb-foxx-services/src/main/routes/data-sources-router.ts +++ b/arangodb-foxx-services/src/main/routes/producer/data-sources-router.ts @@ -15,8 +15,8 @@ */ import { createRouter } from '@arangodb/foxx' -import { DataSource } from '../../external/persistence-api.model' -import { storeDataSources } from '../services/data-source-store' +import { DataSource } from '../../../external/persistence-api.model' +import { storeDataSources } from '../../services/data-source-store' export const dsRouter: Foxx.Router = createRouter() diff --git a/arangodb-foxx-services/src/main/routes/producer/events-router.ts b/arangodb-foxx-services/src/main/routes/producer/events-router.ts new file mode 100644 index 000000000..70092d37e --- /dev/null +++ b/arangodb-foxx-services/src/main/routes/producer/events-router.ts @@ -0,0 +1,53 @@ +/* + * Copyright 2022 ABSA Group Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { createRouter } from '@arangodb/foxx' +import Joi from 'joi' +import { Progress } from '../../../external/persistence-api.model' +import { checkExecutionEventExists, storeExecutionEvent } from '../../services/execution-event-store' + + +export const eventsRouter: Foxx.Router = createRouter() + + +// Store execution event +eventsRouter + .post('/', + (req: Foxx.Request, res: Foxx.Response) => { + const execEvent: Progress = req.body + storeExecutionEvent(execEvent) + res.status('created') + }) + .body(['application/json'], 'Execution Event (Progress) JSON') + .response(201, 'Execution event recorded') + .summary('Record a new execution event') + + +// Check if execution event exists +eventsRouter + .get('/:eventId/_exists', + (req: Foxx.Request, res: Foxx.Response) => { + const exists = checkExecutionEventExists( + req.pathParams.eventId, + req.queryParams.discriminator + ) + res.send(exists) + }) + .pathParam('eventId', Joi.string().min(1).required(), 'Execution Event ID') + .queryParam('discriminator', Joi.string().optional(), 'Execution Event Discriminator') + .response(200, ['application/json'], 'Boolean value indicating if the execution event exists') + .summary('Check if the execution event with the given parameters exists') + diff --git a/arangodb-foxx-services/src/main/routes/producer/index.ts b/arangodb-foxx-services/src/main/routes/producer/index.ts new file mode 100644 index 000000000..620a6241a --- /dev/null +++ b/arangodb-foxx-services/src/main/routes/producer/index.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2022 ABSA Group Limited + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { createRouter } from '@arangodb/foxx' +import { dsRouter } from './data-sources-router' +import { plansRouter } from './plans-router' +import { eventsRouter } from './events-router' + + +const producerRouter: Foxx.Router = createRouter() + +producerRouter.use('/data-sources', dsRouter) +producerRouter.use('/execution-plans', plansRouter) +producerRouter.use('/execution-events', eventsRouter) + +export default producerRouter diff --git a/arangodb-foxx-services/src/main/routes/plans-router.ts b/arangodb-foxx-services/src/main/routes/producer/plans-router.ts similarity index 67% rename from arangodb-foxx-services/src/main/routes/plans-router.ts rename to arangodb-foxx-services/src/main/routes/producer/plans-router.ts index cf82db390..79be1cedc 100644 --- a/arangodb-foxx-services/src/main/routes/plans-router.ts +++ b/arangodb-foxx-services/src/main/routes/producer/plans-router.ts @@ -15,9 +15,8 @@ */ import { createRouter } from '@arangodb/foxx' -import { ExecutionPlanPersistentModel } from '../../external/persistence-api.model' -import { DataSourceActionType } from '../../external/consumer-api.model' -import { checkExecutionPlanExists, getDataSourceURIsByActionType, storeExecutionPlan } from '../services/execution-plan-store' +import { ExecutionPlanPersistentModel } from '../../../external/persistence-api.model' +import { checkExecutionPlanExists, storeExecutionPlan } from '../../services/execution-plan-store' import Joi from 'joi' @@ -36,20 +35,6 @@ plansRouter .summary('Register a new execution plan') -plansRouter - .get('/:planId/data-sources', - (req: Foxx.Request, res: Foxx.Response) => { - const uris = getDataSourceURIsByActionType( - req.pathParams.planId, - req.queryParams.access - ) - res.send(uris) - }) - .pathParam('planId', Joi.string().min(1).required(), 'Execution Plan ID') - .queryParam('access', Joi.string().optional().valid(DataSourceActionType.values).default(null), 'Access type (read/write) to filter by') - .response(200, ['application/json'], 'Array of data source URIs') - - plansRouter .get('/:planId/_exists', (req: Foxx.Request, res: Foxx.Response) => { diff --git a/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/DataSourceRepositoryImpl.scala b/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/DataSourceRepositoryImpl.scala index 5b12e6ec1..1b3938071 100644 --- a/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/DataSourceRepositoryImpl.scala +++ b/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/DataSourceRepositoryImpl.scala @@ -46,7 +46,7 @@ class DataSourceRepositoryImpl @Autowired()( maybeDataSourceUri: Option[String] )(implicit ec: ExecutionContext): Future[Frame[ExecutionEventInfo]] = { - foxxRouter.get[Frame[ExecutionEventInfo]]("/spline/execution-events/_grouped-by-ds", Map( + foxxRouter.get[Frame[ExecutionEventInfo]]("/spline/consumer/execution-events/_grouped-by-ds", Map( "asAtTime" -> asAtTime, "timestampStart" -> maybeWriteTimestampStart.orNull, "timestampEnd" -> maybeWriteTimestampEnd.orNull, @@ -68,7 +68,7 @@ class DataSourceRepositoryImpl @Autowired()( access: Option[DataSourceActionType] )(implicit ec: ExecutionContext): Future[Array[String]] = { - foxxRouter.get[Array[String]](s"/spline/execution-plans/$execPlanId/data-sources", Map( + foxxRouter.get[Array[String]](s"/spline/consumer/execution-plans/$execPlanId/data-sources", Map( "access" -> access.orNull )) } diff --git a/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/ExecutionEventRepositoryImpl.scala b/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/ExecutionEventRepositoryImpl.scala index 2daf75324..17b94a236 100644 --- a/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/ExecutionEventRepositoryImpl.scala +++ b/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/ExecutionEventRepositoryImpl.scala @@ -43,7 +43,7 @@ class ExecutionEventRepositoryImpl @Autowired()( maybeApplicationId: Option[String], maybeDataSourceUri: Option[String] )(implicit ec: ExecutionContext): Future[Frame[ExecutionEventInfo]] = { - foxxRouter.get[Frame[ExecutionEventInfo]]("/spline/execution-events", Map( + foxxRouter.get[Frame[ExecutionEventInfo]]("/spline/consumer/execution-events", Map( "asAtTime" -> asAtTime, "timestampStart" -> maybeTimestampStart.orNull, "timestampEnd" -> maybeTimestampEnd.orNull, diff --git a/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/ExpressionRepositoryImpl.scala b/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/ExpressionRepositoryImpl.scala index b5734e53d..f6d9e4423 100644 --- a/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/ExpressionRepositoryImpl.scala +++ b/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/ExpressionRepositoryImpl.scala @@ -28,6 +28,6 @@ import scala.concurrent.{ExecutionContext, Future} class ExpressionRepositoryImpl @Autowired()(foxxRouter: FoxxRouter) extends ExpressionRepository { override def expressionGraphUsedByOperation(operationId: Id)(implicit ec: ExecutionContext): Future[ExpressionGraph] = { - foxxRouter.get[ExpressionGraph](s"/spline/operations/$operationId/expressions/_graph") + foxxRouter.get[ExpressionGraph](s"/spline/consumer/operations/$operationId/expressions/_graph") } } diff --git a/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/ImpactLineageRepositoryImpl.scala b/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/ImpactLineageRepositoryImpl.scala index bfc52d7aa..724ea5a22 100644 --- a/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/ImpactLineageRepositoryImpl.scala +++ b/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/ImpactLineageRepositoryImpl.scala @@ -28,10 +28,10 @@ import scala.concurrent.{ExecutionContext, Future} class ImpactLineageRepositoryImpl @Autowired()(foxxRouter: FoxxRouter) extends LineageRepository with ImpactRepository { override def lineageOverviewForExecutionEvent(eventId: Id, maxDepth: Int)(implicit ec: ExecutionContext): Future[LineageOverview] = { - foxxRouter.get[LineageOverview](s"/spline/execution-events/$eventId/lineage-overview/$maxDepth") + foxxRouter.get[LineageOverview](s"/spline/consumer/execution-events/$eventId/lineage-overview/$maxDepth") } override def impactOverviewForExecutionEvent(eventId: Id, maxDepth: Int)(implicit ec: ExecutionContext): Future[LineageOverview] = { - foxxRouter.get[LineageOverview](s"/spline/execution-events/$eventId/impact-overview/$maxDepth") + foxxRouter.get[LineageOverview](s"/spline/consumer/execution-events/$eventId/impact-overview/$maxDepth") } } diff --git a/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/OperationRepositoryImpl.scala b/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/OperationRepositoryImpl.scala index 780717ecf..863bfb73d 100644 --- a/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/OperationRepositoryImpl.scala +++ b/consumer-services/src/main/scala/za/co/absa/spline/consumer/service/repo/OperationRepositoryImpl.scala @@ -27,6 +27,6 @@ import scala.concurrent.{ExecutionContext, Future} class OperationRepositoryImpl @Autowired()(foxxRouter: FoxxRouter) extends OperationRepository { override def findById(operationId: Operation.Id)(implicit ec: ExecutionContext): Future[OperationDetails] = { - foxxRouter.get[OperationDetails](s"/spline/operations/$operationId") + foxxRouter.get[OperationDetails](s"/spline/consumer/operations/$operationId") } } diff --git a/persistence/src/main/scala/za/co/absa/spline/persistence/FoxxRouter.scala b/persistence/src/main/scala/za/co/absa/spline/persistence/FoxxRouter.scala index 5c5d75a4d..ffa0a0e7d 100644 --- a/persistence/src/main/scala/za/co/absa/spline/persistence/FoxxRouter.scala +++ b/persistence/src/main/scala/za/co/absa/spline/persistence/FoxxRouter.scala @@ -56,7 +56,11 @@ class FoxxRouter @Autowired()(db: ArangoDatabaseAsync) { .withBody(serializedBody) .post() .asScala - .map(resp => deserializer.deserialize(resp.getBody)) + .map(resp => { + val body = resp.getBody + if (body == null) null.asInstanceOf[A] + else deserializer.deserialize(body) + }) .asInstanceOf[Future[A]] } } diff --git a/producer-services/src/main/scala/za/co/absa/spline/producer/service/repo/ExecutionProducerRepositoryImpl.scala b/producer-services/src/main/scala/za/co/absa/spline/producer/service/repo/ExecutionProducerRepositoryImpl.scala index f3873cf73..a5820702e 100644 --- a/producer-services/src/main/scala/za/co/absa/spline/producer/service/repo/ExecutionProducerRepositoryImpl.scala +++ b/producer-services/src/main/scala/za/co/absa/spline/producer/service/repo/ExecutionProducerRepositoryImpl.scala @@ -42,13 +42,13 @@ class ExecutionProducerRepositoryImpl @Autowired()( override def insertExecutionPlan(executionPlan: apiModel.ExecutionPlan)(implicit ec: ExecutionContext): Future[Unit] = retryer.execute({ val eventualPlanExists: Future[Boolean] = foxxRouter.get[Boolean]( - s"/spline/execution-plans/${executionPlan.id}/_exists", Map( + s"/spline/producer/execution-plans/${executionPlan.id}/_exists", Map( "discriminator" -> executionPlan.discriminator.orNull )) val eventualPersistedDataSources: Future[Seq[DataSource]] = { val dataSources = executionPlan.dataSources.map(DataSource.apply).toSeq - Future.traverse(dataSources)(foxxRouter.post[DataSource]("/spline/data-sources", _)) + Future.traverse(dataSources)(foxxRouter.post[DataSource]("/spline/producer/data-sources", _)) } for { @@ -62,7 +62,7 @@ class ExecutionProducerRepositoryImpl @Autowired()( // No execution plan with the given ID found. // Let's insert one. val eppm = ExecutionPlanPersistentModelBuilder.toPersistentModel(executionPlan, persistedDSKeyByURI) - foxxRouter.post[Nothing]("/spline/execution-plans", eppm) + foxxRouter.post[Nothing]("/spline/producer/execution-plans", eppm) } } yield () }) @@ -73,7 +73,7 @@ class ExecutionProducerRepositoryImpl @Autowired()( val eventualEventExists: Future[Boolean] = foxxRouter.get[Boolean]( - s"/spline/execution-events/$eventKey/_exists", Map( + s"/spline/producer/execution-events/$eventKey/_exists", Map( "discriminator" -> e.discriminator.orNull )) @@ -97,7 +97,7 @@ class ExecutionProducerRepositoryImpl @Autowired()( planKey = e.planId.toString, execPlanDetails = null // the value is populated below in the transaction script ) - foxxRouter.post[Nothing]("/spline/execution-events", p) + foxxRouter.post[Nothing]("/spline/producer/execution-events", p) } } yield () })