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

Hazelcast cache - multinstances

Open mkraszew opened this issue 3 years ago • 0 comments

Overview of the issue

I have two instances of the same microservice. If I make a restart of this instances parallel one of the instances has 2 Hazelcast members, but second one has only one (itself).

Motivation for or Use Case

If I make an update of entity on one instance, this change isn't reflected on second one.

Reproduce the error

Prepare two instances of the same microservice. Start both of them at the same time. Make an update of some enity via REST API on one of the instances. Check data via REST API on second instance.

Related issues
Suggest a Fix

Use com.hazelcast:hazelcast-eureka-one library OR sequential restart OR both solutions?

JHipster Version(s)

7.3.0

JHipster configuration

INFO! Using JHipster version installed globally

JHipster Version(s)
[email protected] /home/mkraszew/apps/bosch/microservices/maas.b2c.microservice.user-java
└── (empty)

JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.bosch.iot.user",
      "nativeLanguage": "en"
    },
    "jhipsterVersion": "7.3.0",
    "applicationType": "microservice",
    "baseName": "user",
    "packageName": "com.bosch.iot.user",
    "packageFolder": "com/bosch/iot/user",
    "serverPort": "8084",
    "authenticationType": "oauth2",
    "cacheProvider": "hazelcast",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mssql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": "eureka",
    "buildTool": "maven",
    "enableSwaggerCodegen": true,
    "jwtSecretKey": "YourJWTSecretKeyWasReplacedByThisMeaninglessTextByTheJHipsterInfoCommandForObviousSecurityReasons",
    "testFrameworks": ["gatling"],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": true,
    "clientPackageManager": "npm",
    "nativeLanguage": "en",
    "languages": ["en", "de"],
    "blueprints": [],
    "skipClient": true,
    "skipUserManagement": true,
    "embeddableLaunchScript": false,
    "creationTimestamp": 1588747924881,
    "skipServer": false,
    "skipCheckLengthOfIdentifier": false,
    "skipFakeData": false,
    "pages": [],
    "reactive": false,
    "enableGradleEnterprise": false,
    "clientFramework": "angularX",
    "clientTheme": "none",
    "clientThemeVariant": "",
    "withAdminUi": false,
    "entities": [
      "Address",
      "PersonBp",
      "CompanyBp",
      "Contact",
      "BpSaga",
      "BpChapter",
      "LegalEntity",
      "CompanyCode",
      "CostCenter",
      "CompanySubAccount",
      "Ready2Order"
    ]
  },
  "generator-jhipster-entity-audit": {
    "auditFramework": "custom",
    "auditPage": true,
    "lastLiquibaseTimestamp": 1601041365000
  }
}
JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
entity Address {
  country String required minlength(2) maxlength(2)
  houseNumber String
  street String
  city String required minlength(1)
  postalCode String
  state String
  region String
  crmCustomerId String
  /**
   * business key of business partner.address in second master data system PMD
   */
  crmSecondaryCustomerId String
  crmAddressUuid String
}
entity PersonBp {
  /**
   * user identifier matching keycloak id
   */
  identifier String required unique minlength(1)
  storeId String required minlength(1)
  firstName String required minlength(1)
  lastName String required minlength(1)
  email String
  phone String
  language String
  /**
   * The approval (regarding both APPROVED and PENDING_APPROVAL) is not only meant for the registration, but for any change that needs to be approved in CRM.
   */
  status BusinessPartnerStatus
  /**
   * Bpmd synchronization status of company as Business Partner.
   */
  bpmdSyncStatus BpmdSyncStatus
  /**
   * CRM is Customer Relationship Management
   */
  crmId String
  /**
   * Minimum ipv4 length is 7 characters
   */
  ipAddress String required minlength(7)
  /**
   * If the identity management is federated (eg. Keycloak => CIAM) this is the identifier representing it (eg. CIAM-id). Can be null (eg. no federation).
   */
  federatedIdentity String
  /**
   * approval time - on BPMD update confirmation call
   */
  approvalTime Instant
  /**
   * homeCountry
   */
  country String required minlength(2) maxlength(2)
  /**
   * Person reference to external system
   */
  externalReference String
}
entity CompanyBp {
  /**
   * An id of the group in keycloak.\nImplements Identifiable interface.
   */
  identifier String required unique minlength(1)
  storeId String required minlength(1)
  name String required minlength(1)
  language String
  phone String
  status BusinessPartnerStatus
  bpmdSyncStatus BpmdSyncStatus
  country String required minlength(2) maxlength(2)
  /**
   * CRM is Customer Relationship Management
   */
  crmId String
  /**
   * business key of business partner in second master data system PMD
   */
  crmSecondaryId String
  /**
   * in case of Bosch internal BusinessPartner reference to Bosch LegalEntity Master Data ("pgNumber")
   */
  boschLegalEntityReference String
  taxId String
  invoiceEmail String
  communicationEmail String
  /**
   * Company reference to external system
   */
  externalReference String
  /**
   * Approval time of Business Partner - on CRM (eg. BPMD) approval, eg. update
   */
  approvedOn Instant
}
entity Contact {
  /**
   * user identifier matching keycloak id of User for ContactAccount
   */
  identifier String required unique minlength(1)
  storeId String required minlength(1)
  firstName String minlength(1)
  lastName String minlength(1)
  /**
   * Minimum ipv4 length is 7 characters
   */
  ipAddress String required minlength(7)
  /**
   * If the identity is federated (eg. Keycloak => CIAM)\nthis is the identifier representing it (eg. CIAM-id).\nCan be null (eg. no federation).
   */
  federatedIdentity String
  language String
  email String
  phone String
  country String
  /**
   * Contact reference to external system
   */
  externalReference String
}
/**
 * Business Partner Saga entity implementation having either {@code @ManyToOne} towards {@code PersonBp} or {@code CompanyBp}.
 */
entity BpSaga {
  /**
   * Saga identifier = BpSagaType + '::' + BP.identifier.
   */
  identifier String required unique minlength(1)
  /**
   * Business Partner Saga Type.
   */
  sagaType BpSagaType required
}
/**
 * Business Partner Chapter entity implementation.
 */
entity BpChapter {
  /**
   * Chapter status.
   */
  status ChapterStatus required
  /**
   * Business Partner Chapter type.
   */
  chapterType BpChapterType required
}
/**
 * Legal Entity from MDS.
 */
entity LegalEntity {
  /**
   * Bosch REF-MDS id of legal Entity
   */
  identifier String unique required
  /**
   * further key for legal Entity , e.g. used in BP master data BP.tradingPartnerNumber = pgNumber
   */
  pgNumber String unique required
  /**
   * Value from MDS reporting file - column Long des
   */
  description String
  /**
   * Value from MDS reporting file - column Unit Code
   */
  unitCode String
  /**
   * Value from MDS reporting file - column Country ID
   */
  country String required minlength(2) maxlength(2)
  /**
   * The job identifier that this entity instance was exported
   */
  importJobIdentifier String
}
/**
 * Company Code from MDS.
 */
entity CompanyCode {
  /**
   * Value from MDS reporting file - column ComC
   */
  identifier String unique required
  /**
   * Value from MDS reporting file - column Country ID
   */
  country String required minlength(2) maxlength(2)
  /**
   * The job identifier that this entity instance was exported
   */
  importJobIdentifier String
  /**
   * Value from MDS reporting file - column Organizational Area
   */
  organizationalArea String
}
/**
 * Cost Center from MDS.
 */
entity CostCenter {
  /**
   * Value from MDS reporting file - column Cost Center
   */
  identifier String unique required
  /**
   * Value from MDS reporting file - column Cost Center Name
   */
  name String required
  /**
   * Value from MDS reporting file - column Cost Center Description
   */
  description String required
  /**
   * Value from MDS reporting file - column Cost Center Category
   */
  category String required minlength(1) maxlength(2)
  /**
   * The job identifier that this entity instance was exported
   */
  importJobIdentifier String
  /**
   * Value from MDS reporting file - column Department
   */
  department String
}
/**
 * Entity for sub account of company account, e.g. for costcenter
 */
entity CompanySubAccount {
  /**
   * An id of the group in keycloak.\nImplements Identifiable interface.
   */
  identifier String required unique minlength(1)
  storeId String required minlength(1)
  subAccountType SubAccountType
  scope String
  /**
   * An reference to SubAccount in external system.
   */
  externalReference String
}
/**
 * Ready2Order event from BRIM.
 */
entity Ready2Order {
  businessPartnerId String required
  salesOrg String required
  division String required
  distributionChannel String required
  receivedOn Instant required
}
enum BusinessPartnerStatus {
  APPROVED,
  PENDING_APPROVAL,
  DENIED,
  NOT_REGISTERED_IN_BPMD,
  ANONYMIZED
}
enum BpmdSyncStatus {
  DONE,
  IN_PROGRESS,
  FAILED,
  TO_SEND
}
enum BpSagaType {
  REGISTRATION,
  UPDATE
}
enum ChapterStatus {
  CREATED,
  PENDING,
  FAILED,
  FINISHED
}
enum BpChapterType {
  CRM_REGISTRATION,
  READY_TO_ORDER,
  CONSENT,
  REGISTRATION_EMAIL,
  REGISTRATION_END_EMAIL,
  OIDC_UPDATE
}
enum SubAccountType {
  COSTCENTER
}

relationship OneToMany {
  PersonBp{address} to Address{personBp}
  CompanyBp{address} to Address{companyBp}
  /**
   * Chapters of this Saga.
   */
  BpSaga{chapter} to
  /**
   * Saga of this Chapter.
   */
  BpChapter{saga}
  LegalEntity{companyCode(pgNumber)} to CompanyCode{legalEntity(pgNumber)}
  CompanyCode{costCenter(identifier)} to CostCenter{companyCode(identifier)}
  CompanyBp{companySubAccount} to CompanySubAccount{companyBp}
}
relationship ManyToOne {
  /**
   * PersonBp Hero of this Saga. If {@code null}, then the hero is the {@code CompanyBp}.
   */
  BpSaga{personBp} to PersonBp
  /**
   * CompanyBp Hero of this Saga. If {@code null}, then the hero is the {@code PersonBp}.
   */
  BpSaga{companyBp} to CompanyBp
}
relationship ManyToMany {
  CompanyBp{contacts} to Contact{companyBps}
  CompanySubAccount{contact} to Contact{companySubAccount}
}

service Address, PersonBp, CompanyBp, Contact, BpSaga, BpChapter, LegalEntity, CompanyCode, CostCenter, CompanySubAccount, Ready2Order with serviceImpl
microservice Address, PersonBp, CompanyBp, Contact, BpSaga, BpChapter, LegalEntity, CompanyCode, CostCenter, CompanySubAccount, Ready2Order with user
clientRootFolder Address, PersonBp, CompanyBp, Contact, BpSaga, BpChapter, LegalEntity, CompanyCode, CostCenter, CompanySubAccount, Ready2Order with user
paginate PersonBp, CompanyBp, Contact, BpSaga, BpChapter, LegalEntity, CompanyCode, CostCenter, CompanySubAccount, Ready2Order with pagination
filter PersonBp, CompanyBp, BpSaga, BpChapter

Environment and Tools

java version "11.0.4" 2019-07-16 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.4+10-LTS) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.4+10-LTS, mixed mode)

git version 2.32.0

node: v16.15.0

npm: 8.5.5

Docker version 20.10.7, build 20.10.7-0ubuntu5.1

docker-compose version 1.27.4, build unknown

Congratulations, JHipster execution is complete! Sponsored with ❤️ by @oktadev.

Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System

Ubuntu 21.10

  • [x] Checking this box is mandatory (this is just to show you read everything)

mkraszew avatar Jun 14 '22 14:06 mkraszew