261 lines
7.2 KiB
Markdown
261 lines
7.2 KiB
Markdown
|
#SYSTEM :: ENTAXY :: CORE :: EVENTS :: REST
|
||
|
|
||
|
Рутовый контекст сервиса по умолчанию **topic-management**,
|
||
|
при смене контекста требуется перераздать права на данный сервис
|
||
|
|
||
|
**Методы:**
|
||
|
|
||
|
- create - создать топик
|
||
|
Запрос:
|
||
|
POST server:9090/topic-management/create
|
||
|
Тело
|
||
|
}
|
||
|
"topicName": "boomNews",
|
||
|
"possibleSubscribers" : ["systemUuid1", "systemUuid2"],
|
||
|
"possiblePublishers" : ["systemUuid3", "systemUuid4"]
|
||
|
}
|
||
|
|
||
|
Ответ:
|
||
|
Статус 201
|
||
|
Тело
|
||
|
{
|
||
|
"title": "Topic created",
|
||
|
"topicName": "<topic_name>",
|
||
|
"subscriberErrors": {
|
||
|
"systemNotFound": [
|
||
|
"<system_uuid>"
|
||
|
]
|
||
|
},
|
||
|
"publisherErrors": {
|
||
|
"systemNotFound": []
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- update - изменить топик (название не меняется, так как на него завязана сама очередь в брокере)
|
||
|
Запрос:
|
||
|
POST server:9090/topic-management/update
|
||
|
Тело
|
||
|
}
|
||
|
"topicName": "boomNews",
|
||
|
"possibleSubscribers" : ["systemUuid1", "systemUuid2"],
|
||
|
"possiblePublishers" : ["systemUuid3", "systemUuid4"]
|
||
|
}
|
||
|
Ответ:
|
||
|
Статус 201
|
||
|
Тело
|
||
|
{
|
||
|
"title": "Topic updated",
|
||
|
"topicName": "<topic_name>",
|
||
|
"subscriberErrors": {
|
||
|
"systemNotFound": [
|
||
|
"<system_uuid>"
|
||
|
]
|
||
|
},
|
||
|
"publisherErrors": {
|
||
|
"systemNotFound": []
|
||
|
}
|
||
|
}
|
||
|
|
||
|
- delete - удалить топик, так же удаляется подписки, права и консьюмеры в брокере
|
||
|
Запрос:
|
||
|
POST server:9090/topic-management/delete
|
||
|
Тело
|
||
|
{
|
||
|
"topicName": "boomNews"
|
||
|
}
|
||
|
|
||
|
Ответ:
|
||
|
Статус 200
|
||
|
Тело
|
||
|
{
|
||
|
"title": "Topic deleted",
|
||
|
"topicName": "<topic_name>"
|
||
|
}
|
||
|
|
||
|
- clean - очистить топики и подписки, помеченные на удаление топики и подписки будут окончательно удалены
|
||
|
Запрос:
|
||
|
POST server:9090/topic-management/clean
|
||
|
|
||
|
Ответ:
|
||
|
Статус 200
|
||
|
Тело
|
||
|
{
|
||
|
"title": "Cleaned"
|
||
|
}
|
||
|
|
||
|
- subscribe - подписаться на топик
|
||
|
Запрос:
|
||
|
POST server:9092/topic-subscription/subscribe
|
||
|
Тело
|
||
|
{
|
||
|
"topicName": "boomNews",
|
||
|
"subscriptionType": "PUSH"
|
||
|
}
|
||
|
|
||
|
Ответ:
|
||
|
Статус 201
|
||
|
Тело
|
||
|
{
|
||
|
"title": "Subscription created",
|
||
|
"topicName": "<topic_name>",
|
||
|
"systemName": "<system_name>",
|
||
|
"subscriptionType": "<subscription_type>"
|
||
|
}
|
||
|
|
||
|
Массовая обработка при наличии права manage для данного сервиса.
|
||
|
Запрос:
|
||
|
POST server:9092/topic-subscription/subscribe
|
||
|
Тело
|
||
|
{
|
||
|
"topicName": "boomNews",
|
||
|
"systemUuids": [
|
||
|
{"systemUuid": "NNNNNNNN-NNNN-NNNN-NNNN-NNNNNNNNNNNN", "subscriptionType": "PUSH"},
|
||
|
{"systemUuid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "subscriptionType": "PULL"},
|
||
|
{"systemUuid": "YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY", "subscriptionType": "PULL"}
|
||
|
]
|
||
|
}
|
||
|
|
||
|
Ответ:
|
||
|
Статус 200
|
||
|
Тело
|
||
|
[
|
||
|
{
|
||
|
"title": "Internal Server Error",
|
||
|
"detail": "System not found NNNNNNNN-NNNN-NNNN-NNNN-NNNNNNNNNNNN",
|
||
|
"reason": "javax.persistence.NoResultException: No entity found for query"
|
||
|
},
|
||
|
{
|
||
|
"title": "Subscription created",
|
||
|
"topicName": "ooooo111-ff6e-4219-a878-bff120c495f1",
|
||
|
"systemUUID": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
|
||
|
"subscriptionType": "PULL"
|
||
|
},
|
||
|
{
|
||
|
"title": "Forbidden",
|
||
|
"detail": "No permission to subscribe for system YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY"
|
||
|
}
|
||
|
]
|
||
|
|
||
|
|
||
|
|
||
|
- unsubscribe - отписаться от топика
|
||
|
Запрос:
|
||
|
POST server:9092/topic-subscription/unsubscribe
|
||
|
Тело
|
||
|
{
|
||
|
"topicName": "boomNews"
|
||
|
}
|
||
|
|
||
|
Ответ:
|
||
|
Статус 200
|
||
|
Тело
|
||
|
{
|
||
|
"title": "Subscription deleted",
|
||
|
"topicName": "<topic_name>",
|
||
|
"systemName": "<system_name>"
|
||
|
}
|
||
|
|
||
|
Массовая обработка при наличии права manage для данного сервиса.
|
||
|
Запрос:
|
||
|
POST server:9092/topic-subscription/unsubscribe
|
||
|
Тело
|
||
|
{
|
||
|
"topicName": "boomNews",
|
||
|
"systemUuids": [
|
||
|
{"systemUuid": "NNNNNNNN-NNNN-NNNN-NNNN-NNNNNNNNNNNN", "subscriptionType": "PUSH"},
|
||
|
{"systemUuid": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "subscriptionType": "PULL"},
|
||
|
{"systemUuid": "YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY", "subscriptionType": "PULL"}
|
||
|
]
|
||
|
}
|
||
|
|
||
|
Ответ:
|
||
|
Статус 200
|
||
|
Тело
|
||
|
[
|
||
|
{
|
||
|
"title": "Internal Server Error",
|
||
|
"detail": "System not found NNNNNNNN-NNNN-NNNN-NNNN-NNNNNNNNNNNN",
|
||
|
"reason": "javax.persistence.NoResultException: No entity found for query"
|
||
|
},
|
||
|
{
|
||
|
"title": "Subscription deleted",
|
||
|
"topicName": "ooooo111-ff6e-4219-a878-bff120c495f1",
|
||
|
"systemUUID": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
|
||
|
},
|
||
|
{
|
||
|
"title": "Subscription not found",
|
||
|
"topicName": "ooooo111-ff6e-4219-a878-bff120c495f1",
|
||
|
"systemUUID": "YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY"
|
||
|
}
|
||
|
]
|
||
|
|
||
|
- publish - опубликовать событие
|
||
|
Запрос:
|
||
|
POST server:9092/topic-subscription/publish
|
||
|
Тело
|
||
|
{
|
||
|
"topicName": "boomNews", "message": "messageText2"
|
||
|
}
|
||
|
|
||
|
Ответ:
|
||
|
Статус 200
|
||
|
Тело
|
||
|
{
|
||
|
"title": "Message published",
|
||
|
"topicName": "<topic_name>"
|
||
|
}
|
||
|
|
||
|
**Ответ при ошибке**
|
||
|
|
||
|
- Передан некорректный JSON или логин не определён
|
||
|
Статус 400
|
||
|
Тело
|
||
|
{
|
||
|
"title": "Incorrect input parameters",
|
||
|
"detail": "Cannot parse incoming JSON or login/system not defined"
|
||
|
}
|
||
|
|
||
|
- Подписка не найдена
|
||
|
Статус 404
|
||
|
Тело
|
||
|
{
|
||
|
"title": "Subscription not found",
|
||
|
"topicName": "${exchangeProperty.topicName}",
|
||
|
"systemUUID": "${header.X-SystemUuid}"
|
||
|
}
|
||
|
|
||
|
- Топик не зарегистрирован
|
||
|
Статус 400
|
||
|
Тело
|
||
|
{
|
||
|
"title": "Topic not registered",
|
||
|
"topicName": "${exchangeProperty.topicName}"
|
||
|
}
|
||
|
|
||
|
- Система не найдена
|
||
|
Статус 500
|
||
|
Тело
|
||
|
{
|
||
|
"title": "Internal Server Error",
|
||
|
"detail": "System not found ${header.X-SystemUuid}",
|
||
|
"reason": "${exception.stacktrace}"
|
||
|
}
|
||
|
|
||
|
- Неизвестный тип подписки
|
||
|
Статус 500
|
||
|
Тело
|
||
|
{
|
||
|
"title": "Internal Server Error",
|
||
|
"detail": "Unknown subscription type ${exchangeProperty.subscriptionType}",
|
||
|
"reason": "${exception.stacktrace}"
|
||
|
}
|
||
|
|
||
|
- Неизвестная ошибка
|
||
|
Статус 500
|
||
|
Тело
|
||
|
{
|
||
|
"title": "Internal Server Error",
|
||
|
"detail": "Unknown exception",
|
||
|
"reason": "${exception.stacktrace}"
|
||
|
}
|