001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.activemq.transport.stomp; 018 019 public interface Stomp { 020 String NULL = "\u0000"; 021 String NEWLINE = "\n"; 022 023 public static interface Commands { 024 String CONNECT = "CONNECT"; 025 String SEND = "SEND"; 026 String DISCONNECT = "DISCONNECT"; 027 String SUBSCRIBE = "SUB"; 028 String UNSUBSCRIBE = "UNSUB"; 029 030 String BEGIN_TRANSACTION = "BEGIN"; 031 String COMMIT_TRANSACTION = "COMMIT"; 032 String ABORT_TRANSACTION = "ABORT"; 033 String BEGIN = "BEGIN"; 034 String COMMIT = "COMMIT"; 035 String ABORT = "ABORT"; 036 String ACK = "ACK"; 037 } 038 039 public interface Responses { 040 String CONNECTED = "CONNECTED"; 041 String ERROR = "ERROR"; 042 String MESSAGE = "MESSAGE"; 043 String RECEIPT = "RECEIPT"; 044 } 045 046 public interface Headers { 047 String SEPERATOR = ":"; 048 String RECEIPT_REQUESTED = "receipt"; 049 String TRANSACTION = "transaction"; 050 String CONTENT_LENGTH = "content-length"; 051 String TRANSFORMATION = "transformation"; 052 String TRANSFORMATION_ERROR = "transformation-error"; 053 /** 054 * This header is used to instruct ActiveMQ to construct the message 055 * based with a specific type. 056 */ 057 String AMQ_MESSAGE_TYPE = "amq-msg-type"; 058 059 public interface Response { 060 String RECEIPT_ID = "receipt-id"; 061 } 062 063 public interface Send { 064 String DESTINATION = "destination"; 065 String CORRELATION_ID = "correlation-id"; 066 String REPLY_TO = "reply-to"; 067 String EXPIRATION_TIME = "expires"; 068 String PRIORITY = "priority"; 069 String TYPE = "type"; 070 String PERSISTENT = "persistent"; 071 } 072 073 public interface Message { 074 String MESSAGE_ID = "message-id"; 075 String DESTINATION = "destination"; 076 String CORRELATION_ID = "correlation-id"; 077 String EXPIRATION_TIME = "expires"; 078 String REPLY_TO = "reply-to"; 079 String PRORITY = "priority"; 080 String REDELIVERED = "redelivered"; 081 String TIMESTAMP = "timestamp"; 082 String TYPE = "type"; 083 String SUBSCRIPTION = "subscription"; 084 String USERID = "JMSXUserID"; 085 String ORIGINAL_DESTINATION = "original-destination"; 086 } 087 088 public interface Subscribe { 089 String DESTINATION = "destination"; 090 String ACK_MODE = "ack"; 091 String ID = "id"; 092 String SELECTOR = "selector"; 093 094 public interface AckModeValues { 095 String AUTO = "auto"; 096 String CLIENT = "client"; 097 String INDIVIDUAL = "client-individual"; 098 } 099 } 100 101 public interface Unsubscribe { 102 String DESTINATION = "destination"; 103 String ID = "id"; 104 } 105 106 public interface Connect { 107 String LOGIN = "login"; 108 String PASSCODE = "passcode"; 109 String CLIENT_ID = "client-id"; 110 String REQUEST_ID = "request-id"; 111 } 112 113 public interface Error { 114 String MESSAGE = "message"; 115 } 116 117 public interface Connected { 118 String SESSION = "session"; 119 String RESPONSE_ID = "response-id"; 120 } 121 122 public interface Ack { 123 String MESSAGE_ID = "message-id"; 124 } 125 } 126 127 public enum Transformations { 128 JMS_BYTE, 129 JMS_XML, 130 JMS_JSON, 131 JMS_OBJECT_XML, 132 JMS_OBJECT_JSON, 133 JMS_MAP_XML, 134 JMS_MAP_JSON, 135 JMS_ADVISORY_XML, 136 JMS_ADVISORY_JSON; 137 138 public String toString() { 139 return name().replaceAll("_", "-").toLowerCase(); 140 } 141 142 public static Transformations getValue(String value) { 143 return valueOf(value.replaceAll("-", "_").toUpperCase()); 144 } 145 } 146 }