fromStream('title:A4CAABEE-D8A1-4581-9444-61950FB7584E')
.when(function (s, e) {
var newStreamName = 'new_title:A4CAABEE-D8A1-4581-9444-61950FB7584E';
emit(newStreamName, e.eventType, e.data, e.metadata);
})
➜ ~ curl -i http://localhost:2113/projection/migration/query%3Fconfig=yes -H "Accept: application/json" -u "admin:changeit"
HTTP/1.1 200 OK
Access-Control-Allow-Methods: GET, PUT, OPTIONS
Access-Control-Allow-Headers: Content-Type, X-Requested-With, X-Forwarded-Host, X-Forwarded-Prefix, X-PINGOTHER, Authorization, ES-LongPoll, ES-ExpectedVersion, ES-EventId, ES-EventType, ES-RequiresMaster, ES-HardDelete, ES-ResolveLinkTos
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Location, ES-Position, ES-CurrentVersion
Cache-Control: max-age=0, no-cache, must-revalidate
Vary: Accept
Content-Type: application/json; charset=utf-8
Server: Mono-HTTPAPI/1.0
Date: Sat, 11 Apr 2020 00:33:11 GMT
Content-Length: 574
Keep-Alive: timeout=15,max=100
{
"msgTypeId": 262,
"name": "migration",
"query": "fromStream('title:A4CAABEE-D8A1-4581-9444-61950FB7584E')\r\n.when(function (s, e) {\r\n var newStreamName = 'new_title:A4CAABEE-D8A1-4581-9444-61950FB7584E';\r\n emit(newStreamName, e.eventType, e.data, e.metadata);\r\n})\r\n",
"emitEnabled": true,
"definition": {
"allEvents": true,
"categories": [],
"events": [],
"streams": [
"title:A4CAABEE-D8A1-4581-9444-61950FB7584E"
],
"options": {}
},
"outputConfig": {
"resultStreamName": "$projections-migration-result"
}
}%
➜ ~ curl -i http://localhost:2113/projections/any -H "Accept: application/json" -u "admin:changeit"
{
"coreProcessingTime": 0,
"version": 2,
"epoch": -1,
"effectiveName": "migration",
"writesInProgress": 0,
"readsInProgress": 0,
"partitionsCached": 1,
"status": "Completed/Stopped/Writing results",
"stateReason": "",
"name": "migration",
"mode": "OneTime",
"position": "Phase: 1 (completed)",
"progress": 100.0,
"lastCheckpoint": "Phase: 1 (completed)",
"eventsProcessedAfterRestart": 1,
"statusUrl": "http://localhost:2113/projection/migration",
"stateUrl": "http://localhost:2113/projection/migration/state",
"resultUrl": "http://localhost:2113/projection/migration/result",
"queryUrl": "http://localhost:2113/projection/migration/query%3Fconfig=yes",
"enableCommandUrl": "http://localhost:2113/projection/migration/command/enable",
"disableCommandUrl": "http://localhost:2113/projection/migration/command/disable",
"checkpointStatus": "",
"bufferedEvents": 0,
"writePendingEventsBeforeCheckpoint": 0,
"writePendingEventsAfterCheckpoint": 0
}
➜ ~ curl -i http://localhost:2113/projection/migration/state -H "Accept: application/json" -u "admin:changeit" HTTP/1.1 200 OK
Access-Control-Allow-Methods: GET, OPTIONS
Access-Control-Allow-Headers: Content-Type, X-Requested-With, X-Forwarded-Host, X-Forwarded-Prefix, X-PINGOTHER, Authorization, ES-LongPoll, ES-ExpectedVersion, ES-EventId, ES-EventType, ES-RequiresMaster, ES-HardDelete, ES-ResolveLinkTos
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Location, ES-Position, ES-CurrentVersion
Cache-Control: max-age=0, no-cache, must-revalidate
Vary: Accept
Content-Type: application/json; charset=utf-8
Server: Mono-HTTPAPI/1.0
Date: Sat, 11 Apr 2020 00:47:35 GMT
Content-Length: 306
Keep-Alive: timeout=15,max=100
{"eventBody":"{\"eventVersion\":1,\"occurredOn\":\"1586655651224\",\"titleId\":{\"id\":\"A4CAABEE-D8A1-4581-9444-61950FB7584E\"},\"copyAddedCount\":2,\"oldCopyCount\":1,\"newCopyCount\":3}","eventId":-1,"occurredOn":"1586655651224","typeName":"com.fnasim.esbookstore.inventory.domain.model.TitleCopyAdded"}%
➜ ~ curl -i http://localhost:2113/streams/new_title:A4CAABEE-D8A1-4581-9444-61950FB7584E -H "Accept: application/json" -u "admin:changeit"
HTTP/1.1 404 Not Found
Access-Control-Allow-Methods: POST, DELETE, GET, OPTIONS
Access-Control-Allow-Headers: Content-Type, X-Requested-With, X-Forwarded-Host, X-Forwarded-Prefix, X-PINGOTHER, Authorization, ES-LongPoll, ES-ExpectedVersion, ES-EventId, ES-EventType, ES-RequiresMaster, ES-HardDelete, ES-ResolveLinkTos
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Location, ES-Position, ES-CurrentVersion
Content-Type: text/plain; charset=utf-8
Server: Mono-HTTPAPI/1.0
Date: Sat, 11 Apr 2020 00:50:59 GMT
Content-Length: 0
Keep-Alive: timeout=15,max=100
On 12 Apr 2020, at 04:04, Farhan Nasim <f.na...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "Event Store" group.
To unsubscribe from this group and stop receiving emails from it, send an email to event-store...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/event-store/128decf4-5c71-417e-99cc-d0bec88b488e%40googlegroups.com.
Please check.
To unsubscribe from this group and stop receiving emails from it, send an email to event...@googlegroups.com.
emitting events only work with continuous projections
fromStream('title:A4CAABEE-D8A1-4581-9444-61950FB7584E')
.when({
$any: function (s, e) {
var newStreamName = 'new_title:A4CAABEE-D8A1-4581-9444-61950FB7584E';
emit(newStreamName, e.eventType, e.data, e.metadata);
}
})