Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Removing no reply #312

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codegen/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ lazy val `kalix-codegen-js-cli` =
lazy val library =
new {
object Version {
val kalix = "1.0.0-M2"
val kalix = "1.0.2"
val commonsIo = "2.8.0"
val kiama = "2.4.0"
val logback = "1.2.3"
Expand Down
2 changes: 1 addition & 1 deletion codegen/js-gen-cli/src/it/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ kalix-npm-js {
}

kalix-proxy {
image = "gcr.io/kalix-public/kalix-proxy:1.0.0-M2"
image = "gcr.io/kalix-public/kalix-proxy:1.0.2"
}
4 changes: 2 additions & 2 deletions docs/src/modules/javascript/examples/action/src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function processUnary(request: Request): replies.Reply {
}

function processStreamedIn(context: Action.StreamedInContext) {
let reply = replies.noReply();
let reply = replies.emptyReply();
context.on("data", request => {
const replyForThisRequest = createReplyForGroup(request.groups[0]);
if (!replyForThisRequest.isEmpty()) {
Expand Down Expand Up @@ -82,7 +82,7 @@ function createReplies(request: Request): replies.Reply[] {
}

function createReplyForGroup(group: ProcessGroup): replies.Reply {
let reply = replies.noReply();
let reply = replies.emptyReply();
group.steps?.forEach(step => {
if (step.reply) {
reply = replies.message(Response.create({ message: step.reply.message }));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
image: gcr.io/kalix-public/kalix-proxy:1.0.2
command: -Dconfig.resource=dev-mode.conf -kalix.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ entity.setBehavior(state => {
function create(customer, customerState, ctx) {
let domainCustomer = apiCustomerToCustomerState(customer)
ctx.emit(domain.CustomerCreated.create({customer: domainCustomer}))
return replies.noReply()
return replies.emptyReply()
}

function changeName(changeNameRequest, customerState, ctx) {
if (!customerState.name && !customer.email) {
return replies.failure("Customer must be created before name can be changed.")
} else {
ctx.emit(domain.CustomerNameChanged.create({ newName: changeNameRequest.newName }))
return replies.noReply()
return replies.emptyReply()
}
}

Expand All @@ -74,7 +74,7 @@ function changeAddress(changeAddressRequest, customerState, ctx) {
return replies.failure("Customer must be created before address can be changed.")
} else {
ctx.emit(domain.CustomerAddressChanged.create({ newAddress: changeAddressRequest.newAddress }))
return replies.noReply()
return replies.emptyReply()
}
}

Expand Down
6 changes: 3 additions & 3 deletions samples/js/js-customer-registry/customer-value-entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ entity.setCommandHandlers({
function create(customer, customerState, ctx) {
let domainCustomer = apiCustomerToCustomerState(customer)
ctx.updateState(domainCustomer)
return replies.noReply()
return replies.emptyReply()
}

function changeName(changeNameRequest, customerState, ctx) {
Expand All @@ -54,7 +54,7 @@ function changeName(changeNameRequest, customerState, ctx) {
} else {
customerState.name = changeNameRequest.newName
ctx.updateState(customerState)
return replies.noReply()
return replies.emptyReply()
}
}

Expand All @@ -64,7 +64,7 @@ function changeAddress(changeAddressRequest, customerState, ctx) {
} else {
customerState.address = changeAddressRequest.newAddress
ctx.updateState(customerState)
return replies.noReply()
return replies.emptyReply()
}
}

Expand Down
2 changes: 1 addition & 1 deletion samples/js/js-doc-snippets/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
image: gcr.io/kalix-public/kalix-proxy:1.0.2
command: -Dconfig.resource=dev-mode.conf -Dkalix.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
2 changes: 1 addition & 1 deletion samples/js/js-doc-snippets/src/myservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const action = new Action(
action.commandHandlers = {
async Consume(request) {
console.log(request);
return replies.noReply();
return replies.emptyReply();
},
// tag::produce[]
async Produce(request) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
image: gcr.io/kalix-public/kalix-proxy:1.0.2
command: -Dconfig.resource=dev-mode.conf -Dkalix.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
image: gcr.io/kalix-public/kalix-proxy:1.0.2
command: -Dconfig.resource=dev-mode.conf -Dkalix.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
2 changes: 1 addition & 1 deletion samples/js/js-valueentity-shopping-cart/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
image: gcr.io/kalix-public/kalix-proxy:1.0.2
command: -Dconfig.resource=dev-mode.conf -Dkalix.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
2 changes: 1 addition & 1 deletion samples/js/valueentity-counter/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
image: gcr.io/kalix-public/kalix-proxy:1.0.2
command: -Dconfig.resource=dev-mode.conf -Dkalix.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
image: gcr.io/kalix-public/kalix-proxy:1.0.2
command: -Dconfig.resource=dev-mode.conf -Dkalix.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
image: gcr.io/kalix-public/kalix-proxy:1.0.2
command: -Dconfig.resource=dev-mode.conf -Dkalix.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
2 changes: 1 addition & 1 deletion samples/ts/ts-valueentity-counter/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
image: gcr.io/kalix-public/kalix-proxy:1.0.2
command: -Dconfig.resource=dev-mode.conf -Dkalix.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
2 changes: 1 addition & 1 deletion samples/ts/ts-valueentity-shopping-cart/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"
services:
kalix-proxy:
image: gcr.io/kalix-public/kalix-proxy:1.0.0-M2
image: gcr.io/kalix-public/kalix-proxy:1.0.2
command: -Dconfig.resource=dev-mode.conf -Dkalix.proxy.eventing.support=google-pubsub-emulator
ports:
- "9000:9000"
Expand Down
2 changes: 1 addition & 1 deletion sdk/config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"frameworkVersion": "1.0.0-M2"
"frameworkVersion": "1.0.2"
}
2 changes: 1 addition & 1 deletion sdk/src/action-support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ class ActionHandler {
);
} else {
// no reply
ctx.write(null);
ctx.write(reply);
}
}

Expand Down
2 changes: 1 addition & 1 deletion sdk/src/reply.jsdoc
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
*
* This may be useful for emitting effects without sending a message.
*
* @function module:kalix.replies~noReply
* @function module:kalix.replies~emptyReply
* @return {module:kalix.replies.Reply} An empty reply.
*/

Expand Down
4 changes: 2 additions & 2 deletions sdk/src/reply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,11 @@ export function failure(description: string, status?: GrpcStatus): Reply {
/**
* Create a reply that contains neither a message nor a forward nor a failure.
*
* This may be useful for emitting effects without sending a message.
* This may be useful for emitting effects while sending an empty message.
*
* @returns an empty reply
*/
export function noReply(): Reply {
export function emptyReply(): Reply {
return new Reply();
}

Expand Down
2 changes: 1 addition & 1 deletion sdk/test/reply.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { GrpcStatus } from '../src/kalix';

describe('Replies', () => {
it('should create an empty Reply', () => {
const reply = replies.noReply();
const reply = replies.emptyReply();

expect(reply.isEmpty()).to.be.true;
expect(reply.getMethod()).to.be.undefined;
Expand Down
4 changes: 2 additions & 2 deletions tck/src/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function processUnary(request: Request) {
}

function processStreamedIn(context: Action.StreamedInContext) {
let reply = replies.noReply();
let reply = replies.emptyReply();
context.on('data', (request) => {
const replyForThisRequest = createReplyForGroup(request.groups[0]);
if (!replyForThisRequest.isEmpty()) {
Expand Down Expand Up @@ -81,7 +81,7 @@ function createReplies(request: Request): replies.Reply[] {
}

function createReplyForGroup(group: IProcessGroup): replies.Reply {
let reply = replies.noReply();
let reply = replies.emptyReply();
group.steps?.forEach((step) => {
if (step.reply) {
reply = replies.message(Response.create({ message: step.reply.message }));
Expand Down