Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7810043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:38:05+00:00 2026-06-02T03:38:05+00:00

My research work is focusing on a Domain Specific Language (DSL) for sensor and

  • 0

My research work is focusing on a Domain Specific Language (DSL) for sensor and actuator augmented system.

I want to quickly test my DSL ( in Java) , which uses Message Oriented middleware ( whose task is to just enable communication among the software components of DSL).

Communication means simple publish/subscribe, event notification, procedure call.

Can you suggest me a quick way to implement a simple middleware in Java ? I just want to test my DSL only on my single machine.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:38:07+00:00Added an answer on June 2, 2026 at 3:38 am

    I thanks StackOverflow community for helping me by answering my questions. Stackoverflow is really great!! 2 months before, I have asked above mentioned question. Now, I have figured out “Simple Message-oriented Middleware for single PC”. I would like to contribute the Simple Message Oriented Middleware to this community. Let me know if you have difficulty in understanding.

    import java.util.HashSet;
    import java.util.Hashtable;
    import java.util.Map;
    import java.util.Set;
    
    public class PubSubMiddleware {
    
        private Map<String, Set<Subscriber>> subscriberMap = new Hashtable<String, Set<Subscriber>>();
        private Map<String, Set<CommandListener>> registeredInstanceMap = new Hashtable<String, Set<CommandListener>>();
    
    
        static PubSubMiddleware singletonInstance;
    
        public static PubSubMiddleware getInstance() {
            if (singletonInstance == null) {
                singletonInstance = new PubSubMiddleware();
            }
            return singletonInstance;
        }
    
        public void subscribe(Subscriber s, String eventSignature) {
    
            registerNewSubscriber(s, eventSignature);
        }
    
        public void publish(String eventName, Object arg) {
    
            Set<Subscriber> subscriberEventSet = getSubscribersForEvent(eventName);
    
            if (subscriberSet != null) {
                for (Subscriber s : subscriberSet) {
                    s.notifyReceived(eventName, arg);
                }
            }
    
        }
        private void registerNewSubscriber(Subscriber s, String eSig) {
    
        if (subscriberMap.containsKey(eSig)) {
    
                Set<Subscriber> tempSet = subscriberMap.get(eSig);
    
                tempSet.add(s);
            } else {
                Set<Subscriber> newSet = new HashSet<Subscriber>();
                newSet.add(s);
                subscriberMap.put(eSig, newSet);
            }
        }
    
        private Set<Subscriber> getSubscribersForEvent(String eventSignature) {
            return subscriberMap.get(eventSignature);
        }
    
        // Request-Response
    
        public Object sendCommand(String methodName, Object arg) {
    
            Set<CommandListener> registeredInstanceSet = getInstanceForCommand(methodName);
    
            if (registeredInstanceSet != null) {
                for (CommandListener s : registeredInstanceSet) {
                    return s.commandReceived(methodName, arg);
                }
            }
            return null;
        }
    
        private Set<CommandListener> getInstanceForCommand(String methodName) {
            return registeredInstanceMap.get(methodName);
        }
    
        private void registerNewInstance(CommandListener s, String listnerSignature) {
    
    
            if (registeredInstanceMap.containsKey(listnerSignature)) {
                Set<CommandListener> tempSet = registeredInstanceMap
                        .get(listnerSignature);
                tempSet.add(s);
            } else {
                Set<CommandListener> newSet = new HashSet<CommandListener>();
                newSet.add(s);
                registeredInstanceMap.put(listnerSignature, newSet);
            }
        }
    
        public void registerInstance(CommandListener s, String listnerSignature) {
            registerNewInstance(s, listnerSignature);
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to work with low level system programming and virtualization for my research.
Why is most of the agent research and work done in Java? Is there
I really new in Java....i work some research in java using tool Tapestry framework...
I work in a research group and we use the PBS queuing system. I'm
So for some research work, I need to analyze a ton of raw movement
I work for a market research company in the online space. We have been
I work in a group that does a large mix of research development and
I work as support staff in a biology research institute as a student, and
After a quick research here and here , the solutions didn't work for my
I am conducting a research on type systems. For this work I am investigating

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.