Can we communicate between two service internally in view protobuf file

Inside view protobuf file we are having more services, can we communicate from one service to another service to get data. Or Is it possible to get data from Service1 table(customer) to Service2 table(product) in the query ?

service Service1 {
option (kalix.codegen) = {
view: {}
};
option (kalix.service).acl.allow = { principal: ALL };
rpc updateCustomer(customerEvent) returns (CustomerState) {
option (kalix.method).eventing.in = {
event_sourced_entity: “customer”
};

option (kalix.method).view.update = {
table: “customer”
transform_updates: true
};
}

rpc getCustomer(customerRequest) returns (stream customerResponse) {
option (kalix.method).view.query = {
query: "SELECT * FROM customer "
};

option (google.api.http) = {
get: “/customer/customerRequest”
};
}
}

service Service2 {
option (kalix.codegen) = {
view: {}
};

option (kalix.service).acl.allow = { principal: ALL };
rpc updateProduct(productEvent) returns (ProductState) {
option (kalix.method).eventing.in = {
event_sourced_entity: “product”
};

option (kalix.method).view.update = {
table: “product”
transform_updates: true
};
}

rpc getProduct(productRequest) returns (stream productResponse) {
option (kalix.method).view.query = {
query: "SELECT * FROM product "
};
option (google.api.http) = {
get: “/product/productRequest”
};
}
}

Entities cannot communicate directly with each other, but you can compose calls to several entities using an action in front, calling the entities in some order or in parallel (see for example Actions as Controllers :: Kalix Documentation).

It is also possible to join events from two entities into a single view using the advanced view queries feature (docs: Implementing Views :: Kalix Documentation ) but note that it requires you to reach out to our support to enable that feature for a specific Kalix service.

1 Like

How to listen event from two different publishers into single view ( as subscriber)?

This can be done with join views.

Check the link posted by Johan and his comment in the last message.

1 Like