generated from konveyor-ecosystem/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2,538 changed files
with
211 additions
and
386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/main/java/com/redhat/coolstore/model/CatalogItemEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
src/main/java/com/redhat/coolstore/persistence/Resources.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
package com.redhat.coolstore.rest; | ||
|
||
import jakarta.ws.rs.ApplicationPath; | ||
import jakarta.ws.rs.core.Application; | ||
|
||
|
||
@ApplicationPath("/services") | ||
public class RestApplication extends Application { | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/com/redhat/coolstore/rest/client/ShippingServiceClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.redhat.coolstore.rest.client; | ||
|
||
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; | ||
|
||
import com.redhat.coolstore.model.ShoppingCart; | ||
|
||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.POST; | ||
|
||
@Path("/shipping") | ||
@RegisterRestClient(configKey="shipping-service-api") | ||
public interface ShippingServiceClient { | ||
|
||
@POST | ||
@Path("/calculateShipping") | ||
public double calculateShipping(ShoppingCart sc); | ||
|
||
@POST | ||
@Path("/calculateShippingInsurance") | ||
public double calculateShippingInsurance(ShoppingCart sc); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 31 additions & 28 deletions
59
src/main/java/com/redhat/coolstore/service/OrderServiceMDB.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,38 @@ | ||
package com.redhat.coolstore.service; | ||
|
||
import jakarta.enterprise.context.ApplicationScoped; | ||
import jakarta.inject.Inject; | ||
import jakarta.jms.TextMessage; | ||
import jakarta.jms.TextMessageListener; | ||
import jakarta.transaction.Transactional; | ||
|
||
import org.eclipse.microprofile.reactive.messaging.Incoming; | ||
|
||
import com.redhat.coolstore.model.Order; | ||
import com.redhat.coolstore.utils.Transformers; | ||
|
||
import io.smallrye.common.annotation.Blocking; | ||
|
||
@ApplicationScoped | ||
public class OrderServiceMDB implements TextMessageListener { | ||
|
||
@Inject | ||
OrderService orderService; | ||
|
||
@Inject | ||
CatalogService catalogService; | ||
|
||
@Override | ||
public void onMessage(TextMessage message) { | ||
System.out.println("\nMessage recd !"); | ||
try { | ||
String orderStr = message.getText(); | ||
System.out.println("Received order: " + orderStr); | ||
Order order = Transformers.jsonToOrder(orderStr); | ||
System.out.println("Order object is " + order); | ||
orderService.save(order); | ||
order.getItemList().forEach(orderItem -> { | ||
catalogService.updateInventoryItems(orderItem.getProductId(), orderItem.getQuantity()); | ||
}); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
} | ||
public class OrderServiceMDB { | ||
|
||
@Inject | ||
OrderService orderService; | ||
|
||
@Inject | ||
CatalogService catalogService; | ||
|
||
@Incoming("orders") | ||
@Blocking | ||
@Transactional | ||
public void onMessage(String orderStr) { | ||
System.out.println("\nMessage recd !"); | ||
|
||
System.out.println("Received order: " + orderStr); | ||
Order order = Transformers.jsonToOrder(orderStr); | ||
System.out.println("Order object is " + order); | ||
orderService.save(order); | ||
order.getItemList().forEach(orderItem -> { | ||
catalogService.updateInventoryItems(orderItem.getProductId(), orderItem.getQuantity()); | ||
}); | ||
} | ||
|
||
} |
Oops, something went wrong.