Skip to content

About

Distributed Java EE e-commerce platform with a REST API gateway, asynchronous JMS communication, JPA persistence, and separate MySQL-backed subsystems.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Distributed E-Commerce Platform

A modular Java EE marketplace platform built around a central REST API, asynchronous JMS messaging, and independently persisted subsystems.

The application supports the core workflows of an online marketplace: user and account management, product listings, shopping carts, wishlists, orders, and transaction tracking. Its distributed architecture separates these responsibilities into independently running applications with dedicated MySQL databases.

Engineering Highlights

  • Request/response communication between the API gateway and backend services over JMS
  • Clear separation of user, catalog, and order-processing domains
  • Independent persistence context and database for each subsystem
  • JAX-RS API layer consumed by a standalone Java client
  • JPA entity models and persistence through EclipseLink
  • Role-based workflows for administrators, sellers, and customers

Features

  • User login and role-based actions
  • City, user, and account balance management
  • Product category and item management
  • Seller-side price and discount updates
  • Shopping cart management
  • Wishlist management
  • Order and transaction overview
  • REST API exposed through a central server
  • Asynchronous communication between the central server and subsystems using JMS
  • Separate MySQL databases for each subsystem

Architecture

flowchart LR
    Client[Console Client] -->|HTTP / REST| API[Central Java EE API]
    API -->|JMS| S1[User Subsystem]
    API -->|JMS| S2[Catalog Subsystem]
    API -->|JMS| S3[Order Subsystem]
    S1 --> DB1[(User Database)]
    S2 --> DB2[(Catalog Database)]
    S3 --> DB3[(Order Database)]
Loading

The system is composed of five Java applications:

  • Centar - central Java EE application that exposes REST endpoints and coordinates requests through JMS
  • Client - console-based Java client that sends REST requests to the central server
  • Podsistem_1 - user, role, city, and account balance management
  • Podsistem_2 - category, product, cart, and wishlist management
  • Podsistem_3 - order and transaction processing

The central server does not own domain data. It acts as an API gateway and coordination layer between the client and the three backend subsystems.

Tech Stack

  • Java 8
  • Java EE 8
  • JAX-RS
  • JMS
  • JPA / EclipseLink
  • MySQL
  • Maven and Ant
  • NetBeans
  • GlassFish application server

Repository Structure

.
+-- baze/
|   +-- podsistem_1_*.sql
|   +-- podsistem_2_*.sql
|   +-- podsistem_3_*.sql
+-- java aplikacije/
|   +-- Centar/
|   +-- Client/
|   +-- Podsistem_1/
|   +-- Podsistem_2/
|   +-- Podsistem_3/

The main implementation is in java aplikacije. The baze directory contains initial SQL dump files used to create and populate the MySQL databases.

Database Setup

The project uses three MySQL databases:

  • podsistem_1
  • podsistem_2
  • podsistem_3

Initial SQL files are included in the baze directory and should be imported before running the applications.

Each subsystem reads its connection settings from its persistence.xml file. Before running the applications, update the JDBC URL and credentials to match your local MySQL environment. The default database host and port are localhost:3306.

JMS Resources

The applications expect the following JMS resources to be configured on the application server:

Resource Purpose
connFactory1 JMS connection factory
myQueue1 Requests for subsystem 1
myQueueO1 Responses from subsystem 1
myQueue2 Requests for subsystem 2
myQueueO2 Responses from subsystem 2
myQueue3 Requests for subsystem 3
myQueueO3 Responses from subsystem 3

Running the Project

  1. Import the SQL files from baze into MySQL.
  2. Configure the required JMS connection factory and queues on the application server.
  3. Update the database credentials in each subsystem's persistence.xml file.
  4. Open the projects from java aplikacije in NetBeans.
  5. Start the subsystem applications:
    • Podsistem_1
    • Podsistem_2
    • Podsistem_3
  6. Deploy Centar to GlassFish.
  7. Run the Client console application.

The client sends requests to:

http://localhost:8080/Centar/api

API Overview

The central server exposes a REST API under /api.

User and Account Operations

Method Endpoint Description
POST /ss1/1 Validate user credentials
POST /ss1/2 Create a city
POST /ss1/3 Create a user
POST /ss1/4 Add money to a user account
POST /ss1/5 Update a user's address and city
GET /ss1/15 Get all cities
GET /ss1/16 Get all users
POST /ss1/100 Check administrator role

Product, Cart, and Wishlist Operations

Method Endpoint Description
POST /ss2/6 Create a category
POST /ss2/7 Create an item
POST /ss2/8 Update item price
POST /ss2/9 Set item discount
POST /ss2/10 Add item to cart
POST /ss2/11 Remove item from cart
POST /ss2/12 Add item to wishlist
POST /ss2/13 Remove item from wishlist
GET /ss2/17 Get all categories
POST /ss2/18 Get items sold by a user
POST /ss2/19 Get cart contents
POST /ss2/20 Get wishlist contents

Order and Transaction Operations

Method Endpoint Description
POST /ss3/21 Get all orders for a user
GET /ss3/22 Get all orders
GET /ss3/23 Get all transactions

Notes

This repository focuses on the Java applications and database initialization files. Generated build outputs and local IDE files are intentionally excluded from version control.

About

Distributed Java EE e-commerce platform with a REST API gateway, asynchronous JMS communication, JPA persistence, and separate MySQL-backed subsystems.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages