Stilts STOMP Server Core


Лицензия

Лицензия

Группа

Группа

org.projectodd.stilts
Идентификатор

Идентификатор

stilts-stomp-server-core
Последняя версия

Последняя версия

0.1.40
Дата

Дата

Тип

Тип

jar
Описание

Описание

Stilts STOMP Server Core
Stilts STOMP Server Core
Организация-разработчик

Организация-разработчик

JBoss by Red Hat

Скачать stilts-stomp-server-core

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.projectodd.stilts/stilts-stomp-server-core/ -->
<dependency>
    <groupId>org.projectodd.stilts</groupId>
    <artifactId>stilts-stomp-server-core</artifactId>
    <version>0.1.40</version>
</dependency>
// https://jarcasting.com/artifacts/org.projectodd.stilts/stilts-stomp-server-core/
implementation 'org.projectodd.stilts:stilts-stomp-server-core:0.1.40'
// https://jarcasting.com/artifacts/org.projectodd.stilts/stilts-stomp-server-core/
implementation ("org.projectodd.stilts:stilts-stomp-server-core:0.1.40")
'org.projectodd.stilts:stilts-stomp-server-core:jar:0.1.40'
<dependency org="org.projectodd.stilts" name="stilts-stomp-server-core" rev="0.1.40">
  <artifact name="stilts-stomp-server-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.projectodd.stilts', module='stilts-stomp-server-core', version='0.1.40')
)
libraryDependencies += "org.projectodd.stilts" % "stilts-stomp-server-core" % "0.1.40"
[org.projectodd.stilts/stilts-stomp-server-core "0.1.40"]

Зависимости

compile (7)

Идентификатор библиотеки Тип Версия
org.projectodd.stilts : stilts-stomp-api jar 0.1.40
org.projectodd.stilts : stilts-stomp-common jar 0.1.40
org.projectodd.stilts : stilts-stomp-server-spi jar 0.1.40
commons-lang : commons-lang jar 2.6
io.netty : netty jar 3.6.2.Final
org.jboss.logging : jboss-logging jar 3.0.0.CR1
org.jboss.logmanager : jboss-logmanager jar 1.3.2.Final

test (5)

Идентификатор библиотеки Тип Версия
org.projectodd.stilts : stilts-stomp-api jar 0.1.40
org.projectodd.stilts : stilts-stomp-client jar 0.1.40
org.projectodd.stilts : stilts-stomp-common jar 0.1.40
junit : junit jar 4.7
org.apache.httpcomponents : httpclient jar 4.3-alpha1

Модули Проекта

Данный проект не имеет модулей.

Stilts - STOMP Integration Layer

http://stilts.projectodd.org/

Building

To build, you need Maven 3 and the appropriate entries in your ~/.m2/settings.xml to use the JBoss maven artifact repositories.

Alternatively, you may use the included support/settings.xml via

    mvn -s ./support/settings.xml install

JBossAS Integration

Make sure you have a JBossAS version that supports the jboss netty bundle. Check if this pull request already made it upstream. If not, use this branch.

Add the the netty bundle to the list of auto installed bundles.

    <modules>
        ...
        <module identifier="org.jboss.netty" startlevel="2"/>
        ...
    </modules>

Set the JBOSS_HOME environment variable and copy the stilts-stomplet-server-bundle.jar to the deployments folder.

    $ export JBOSS_HOME=~/git/.../build/target/jboss-as-7.1.0.Alpha1-SNAPSHOT
	$ mvn install
	$ cp stomplet-server-bundle/target/stilts-stomplet-server-bundle.jar $JBOSS_HOME/standalone/deployments/

Startup the server. You should see

	20:02:42,327 INFO  [org.jboss.osgi.framework.internal.BundleManager] (MSC service thread 1-3) Install bundle: stilts-stomplet-server-bundle:0.1.16.SNAPSHOT
	20:02:42,473 INFO  [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployed "stilts-stomplet-server-bundle.jar"
	20:02:42,527 INFO  [org.projectodd.stilts.stomplet.bundle.StompletServerActivator] (MSC service thread 1-4) start: BundleContext[stilts-stomplet-server-bundle:0.1.16.SNAPSHOT]
	20:02:42,546 INFO  [org.projectodd.stilts.stomplet.bundle.StompletServerActivator] (MSC service thread 1-4) adding transaction manager: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@cbbaf
	20:02:42,628 INFO  [org.jboss.osgi.framework.internal.HostBundleState] (MSC service thread 1-4) Bundle started: stilts-stomplet-server-bund

Now you can run the integration tests

	$ mvn -Djbossas install
	...
	Running org.projectodd.stilts.stomplet.StompletServerTestCase
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.292 sec

How does it work?

The stilts-stomplet-server-bundle has a BundleActivator that

The test bundle has a BundleActivator that registers a Stomplet service

    public void start(BundleContext context) throws Exception {
        log.infof("start: %s", context);
        Dictionary props = new Hashtable();
        props.put("destinationPattern", DESTINATION_QUEUE_ONE);
        registration = context.registerService(Stomplet.class.getName(), new SimpleTestStomplet(), props);
    }

When this service gets tracked, the stilts-stomplet-server-bundle adds it to the running container

        public Object addingService(ServiceReference reference) {
            Stomplet stomplet = (Stomplet) super.addingService(reference);
            log.infof("adding: %s", stomplet);
            try {
                // Copy string properties
                Map props = new HashMap();
                for (String key : reference.getPropertyKeys()) {
                    Object value = reference.getProperty(key);
                    if (value instanceof String) {
                        props.put(key, (String) value);
                    }
                }
                String destinationPattern = props.get("destinationPattern");
                log.infof("adding: %s -> %s", destinationPattern, stomplet);
                container.addStomplet(destinationPattern, stomplet, props);
            } catch (StompException ex) {
                log.errorf(ex, "Cannot add stomplet: %s", stomplet);
            }
            return stomplet;
        }

The test client code should be obvious.

        StompClient client = new StompClient("stomp://localhost");
        client.connect();

        final CountDownLatch latch = new CountDownLatch(3);
        SubscriptionBuilder builder = client.subscribe(DESTINATION_QUEUE_ONE);
        builder.withMessageHandler(new MessageHandler() {
            public void handle(StompMessage message) {
                latch.countDown();
            }
        });
        ClientSubscription subscription = builder.start();
        
        client.send(StompMessages.createStompMessage(DESTINATION_QUEUE_ONE, "start"));

        assertTrue("No latch timeout", latch.await(10, TimeUnit.SECONDS));

        client.send(StompMessages.createStompMessage(DESTINATION_QUEUE_ONE, "stop"));

        subscription.unsubscribe();
        client.disconnect();
org.projectodd.stilts

project:odd

Red Hat Middleware Emerging Technology Group

Версии библиотеки

Версия
0.1.40
0.1.38
0.1.37
0.1.35
0.1.34
0.1.33
0.1.31
0.1.30
0.1.29
0.1.28
0.1.27
0.1.26
0.1.25
0.1.24
0.1.23
0.1.22
0.1.21
0.1.20
0.1.19
0.1.18
0.1.17
0.1.16
0.1.15
0.1.14
0.1.13
0.1.12
0.1.11
0.1.10
0.1.9
0.1.8
0.1.7
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0