jhipster-dotnetcore icon indicating copy to clipboard operation
jhipster-dotnetcore copied to clipboard

How can i create microservices

Open galkzaz opened this issue 3 years ago • 4 comments

how can i create microservices and run it,I'm confused between jhipster --blueprints dotnetcore and jhipster import-jdl app.jdl which one shall I used If I used jhipster --blueprints dotnetcore it will create root foder baseName If I used jhipster import-jdl app.jdl I faces many issues like namespace created like namespace .Configuration package name not used how do i run the whole solution as in java this is my jdl /* Store gateway application */ application { config { baseName store applicationType gateway packageName mystore serviceDiscoveryType consul authenticationType oauth2 prodDatabaseType mysql cacheProvider ehcache buildTool maven clientFramework angularX languages [en, ar-ly]

testFrameworks [cypress, gatling, cucumber]

} entities * }

/* Invoice microservice application */ application { config { baseName invoice

applicationType microservice
packageName mystore
serviceDiscoveryType consul
authenticationType oauth2
prodDatabaseType mysql
buildTool maven
serverPort 8081
languages [en, ar-ly]

} entities Invoice, Shipment }

/* Notification microservice application */ application { config { baseName notification

applicationType microservice
packageName mystore
serviceDiscoveryType consul
authenticationType oauth2
databaseType mongodb
cacheProvider no
enableHibernateCache false
buildTool maven
serverPort 8082
languages [en, ar-ly]

} entities Notification }

/* Entiteis for store service */

/** Product sold by the Online store */ entity Product { name String required description String price BigDecimal required min(0) productSize Size required image ImageBlob }

enum Size { S, M, L, XL, XXL }

entity ProductCategory { name String required description String }

entity Customer { firstName String required lastName String required gender Gender required email String required pattern(/^[^@\s]+@[^@\s]+.[^@\s]+$/) phone String required addressLine1 String required addressLine2 String city String required country String required }

enum Gender { MALE, FEMALE, OTHER }

entity ProductOrder { placedDate Instant required status OrderStatus required code String required }

enum OrderStatus { COMPLETED, PENDING, CANCELLED }

entity OrderItem { quantity Integer required min(0) totalPrice BigDecimal required min(0) status OrderItemStatus required }

enum OrderItemStatus { AVAILABLE, OUT_OF_STOCK, BACK_ORDER }

relationship OneToOne { Customer{user(login) required} to User }

relationship ManyToOne { OrderItem{product(name) required} to Product }

relationship OneToMany { Customer{order} to ProductOrder{customer(email) required}, ProductOrder{orderItem} to OrderItem{order(code) required}, ProductCategory{product} to Product{productCategory(name)} }

/* Entities for Invoice microservice */

entity Invoice { code String required date Instant required details String status InvoiceStatus required paymentMethod PaymentMethod required paymentDate Instant required paymentAmount BigDecimal required productOrderId Long required }

enum InvoiceStatus { PAID, ISSUED, CANCELLED }

enum PaymentMethod { CREDIT_CARD, CASH_ON_DELIVERY, PAYPAL }

entity Shipment { trackingCode String date Instant required details String }

relationship OneToMany { Invoice{shipment} to Shipment{invoice(code) required} }

microservice Invoice, Shipment with invoice

/* Entities for notification microservice */

entity Notification { date Instant required details String sentDate Instant required format NotificationType required userId Long required productId Long required }

enum NotificationType { EMAIL, SMS, PARCEL }

microservice Notification with notification

/* General options */

service * with serviceClass paginate Product, Customer, ProductOrder, Invoice, Shipment, OrderItem with pagination

galkzaz avatar Aug 21 '21 10:08 galkzaz

I think the generator is not working with microservices and there is no docs or tutorial or example for this I tried it my self but many problems and errors I used Jhipster microservices with Java and its easy and well structured

galkzaz avatar Aug 22 '21 08:08 galkzaz

can you try to create the microservice with cli rather than jdl ?

nicolas63 avatar Aug 30 '21 07:08 nicolas63

what do u mean by cli

galkzaz avatar Aug 30 '21 15:08 galkzaz

oh yes sorry cli is not clear, if you create the microservice without jdl ( run jhipster --blueprint dotnetcore and choose microservice) you have now one microservice, you can create a second microservice and next create a gateway. The gateway ask path of the microservice and map route with ocelot and use consul as service discovery

nicolas63 avatar Sep 03 '21 08:09 nicolas63