Skip to content

Commit

Permalink
Adjusts
Browse files Browse the repository at this point in the history
  • Loading branch information
Adriano Santos committed Aug 19, 2024
1 parent b117e02 commit f0a79a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ public final class App {
public static void main(String[] args) throws SpawnException {
Config cfg = Config.createDefaultConfig();

PostalCodeService postalCodeService = new PostalCodeService();
DependencyInjector dependencyInjector = SimpleDependencyInjector.createInjector();
dependencyInjector.bind(PostalCodeService.class, postalCodeService);
dependencyInjector.bind(PostalCodeService.class, new PostalCodeService());

Spawn spawnSystem = new Spawn.SpawnSystem()
.create(cfg.spawnSystemName, dependencyInjector)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@ private Value getPostalCodeData(ActorContext<Common.PostalCodeState> context, Co
log.debug("Received invocation. Message: '{}'. Context: '{}'.", msg, context);
Common.PostalCodeState.Builder builder = Common.PostalCodeState.newBuilder();

if (context.getState().isPresent()) {
Common.PostalCodeState state = context.getState().get();
log.trace("State is present and value is '{}'.", state);
if (context.getState().isPresent() && !Common.PostalCodeStatus.UNKNOWN.equals(state.getStatus()))
return Value.at()
.state(state)
.response(Common.GetResponse.newBuilder().setPostalCode(state).build())
.reply();
.state(state)
.response(Common.GetResponse.newBuilder().setPostalCode(state).build())
.reply();
}

log.trace("State not present.");
Expand Down Expand Up @@ -75,3 +73,4 @@ private Value getPostalCodeData(ActorContext<Common.PostalCodeState> context, Co
.reply();
}
}

0 comments on commit f0a79a0

Please sign in to comment.