MinSrc.java

00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 /* MinSrc.java, see http://ultramessaging.github.io/UMExamples/minsrc/java/ */ import com.latencybusters.lbm.*; public class MinSrc { public static void main(String[] args) throws LBMException{ LBMContext ctx = nil; /* Context object: container for UM "instance". */ LBMSource src = nil; /* Source object: for sending messages. */ /*** Initialization: create necessary UM objects. ***/ ctx = new LBMContext(); { LBMTopic topic = nil; topic = new LBMTopic(ctx, "Greeting"); src = new LBMSource(ctx, topic); } Thread.sleep(1000); /*** Send a message. ***/ src.send("Hello!".getBytes(), 7, LBM.MSG_FLUSH | LBM.SRC_BLOCK); /*** Cleanup: delete UM objects. ***/ Thread.sleep(3000); src.close(); ctx.close(); } /* main */ } /* class MinSrc */