activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r674837 [3/3] - in /activemq/trunk/activemq-protocol-buffer: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/activemq/ src/main/java/org/apache/activemq/protocolbuffer/ src/main/proto/ ...
Date Tue, 08 Jul 2008 14:15:36 GMT
Propchange: activemq/trunk/activemq-protocol-buffer/src/main/java/org/apache/activemq/protocolbuffer/OpenWire.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/trunk/activemq-protocol-buffer/src/main/java/org/apache/activemq/protocolbuffer/OpenWire.java
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/trunk/activemq-protocol-buffer/src/main/proto/openwire.proto
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-protocol-buffer/src/main/proto/openwire.proto?rev=674837&view=auto
==============================================================================
--- activemq/trunk/activemq-protocol-buffer/src/main/proto/openwire.proto (added)
+++ activemq/trunk/activemq-protocol-buffer/src/main/proto/openwire.proto Tue Jul  8 07:15:35
2008
@@ -0,0 +1,149 @@
+// See README.txt for information and build instructions.
+
+package org.apache.activemq.protocolbuffer;
+
+option optimize_for = SPEED;
+option java_package = "org.apache.activemq.protocolbuffer";
+
+option java_outer_classname = "OpenWire";
+
+
+message Command {
+  required int32 command_id = 1;
+  required bool response_required = 2;
+  required int32 command_type = 3;
+  required bytes command_bytes = 4;
+}
+
+
+message Destination {
+  enum DestinationType {
+    QUEUE = 0;
+    TOPIC = 1;
+    TEMP_QUEUE = 2;
+    TEMP_TOPIC = 3;
+  }
+
+  required DestinationType type = 1 [default = QUEUE];
+  required string name = 2;
+}
+
+message LocalTransactionId {
+  // TODO connection ID?
+  required int32 connection_id = 1;
+  required int64 value = 2;
+}
+
+message XATransactionId {
+  required int32 format_id = 1;
+  required bytes branch_qualifier = 2;
+  required bytes global_transaction_id = 3;
+}
+
+// Properties
+message StringProperty {
+  required string name = 1;
+  required string value = 2;
+}   
+
+message BoolProperty {
+  required string name = 1;
+  required bool value = 2;
+}
+
+message ByteProperty {
+  required string name = 1;
+  // TODO no byte?
+  required int32 value = 2;
+}
+
+message ShortProperty {
+  required string name = 1;
+  // TODO no int16?
+  required int32 value = 2;
+}
+
+message IntProperty {
+  required string name = 1;
+  required int32 value = 2;
+}
+
+message LongProperty {
+  required string name = 1;
+  required int32 value = 2;
+}
+
+message FloatProperty {
+  required string name = 1;
+  required float value = 2;
+}
+
+message DoubleProperty {
+  required string name = 1;
+  required double value = 2;
+}
+
+message Properties {
+  repeated StringProperty string_property = 1;
+  repeated IntProperty int_property = 2;
+  repeated BoolProperty bool_property = 3;
+  repeated LongProperty long_property = 4;
+  repeated DoubleProperty double_property = 5;
+  repeated FloatProperty float_property = 6;
+  repeated ShortProperty short_property = 7;
+  repeated ByteProperty byte_property = 8;
+}
+
+// Message
+message Message {
+  required int32 producer_id = 1;
+  required int32 producer_counter = 2;
+
+  // TODO no messageID?
+  
+  required Destination destination = 3;
+  optional Destination original_destination = 4;
+
+  optional string group_id = 5;
+
+  optional bytes property_bytes = 6;
+
+  optional string correlation_id = 7;
+
+  // TODO move this into the 'exchange id'?
+  optional bool persistent = 8;
+
+  optional int64 expiration = 9;
+
+// TODO no byte?
+  optional int32 priority = 10;
+  optional Destination reply_to = 11;
+  optional int64 timestamp = 12;
+  optional string type = 13;
+
+  optional LocalTransactionId local_transaction_id = 14;
+  optional XATransactionId xa_transaction_id = 15;
+
+
+  // TODO why DataStructure and Content?
+  // TODO targetConsumerId?
+
+  optional bool compressed = 16;
+  optional int32 redelivery_counter = 17;
+  repeated string broker_path = 18;
+  repeated string cluster_id = 19;
+
+  optional string user_id = 20;
+
+  optional int64 arrival = 22;
+  optional int64 broker_in_time = 23;
+  optional int64 broker_out_time = 24;
+
+  // TODO required?
+  optional bool droppable = 28;
+  optional bool receivedByDFBridge = 29;
+
+  optional int32 group_sequence = 40;
+
+
+}

Added: activemq/trunk/activemq-protocol-buffer/src/test/java/org/apache/activemq/protocolbuffer/PerformanceTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-protocol-buffer/src/test/java/org/apache/activemq/protocolbuffer/PerformanceTest.java?rev=674837&view=auto
==============================================================================
--- activemq/trunk/activemq-protocol-buffer/src/test/java/org/apache/activemq/protocolbuffer/PerformanceTest.java
(added)
+++ activemq/trunk/activemq-protocol-buffer/src/test/java/org/apache/activemq/protocolbuffer/PerformanceTest.java
Tue Jul  8 07:15:35 2008
@@ -0,0 +1,71 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.protocolbuffer;
+
+import com.google.protobuf.CodedInputStream;
+import com.google.protobuf.CodedOutputStream;
+import junit.framework.TestCase;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class PerformanceTest extends TestCase {
+    protected int messageCount = 10;
+    protected String fileName = "target/messages.openwire";
+
+
+    public void testPerformance() throws Exception {
+        BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(fileName));
+        CodedOutputStream cout = CodedOutputStream.newInstance(out);
+        OpenWire.Destination destination = OpenWire.Destination.newBuilder().setName("FOO.BAR").setType(OpenWire.Destination.DestinationType.QUEUE).build();
+
+        for (int i = 0; i < messageCount; i++) {
+            OpenWire.Message message = OpenWire.Message.newBuilder()
+                    .setDestination(destination)
+                    .setPersistent(true)
+                    .setProducerId(1234)
+                    .setProducerCounter(i)
+                    .setType("type:" + i)
+                    .build();
+
+            System.out.println("Writing message: " + i + " = " + message);
+            message.writeTo(cout);
+            //cout.flush();
+        }
+        cout.flush();
+        out.close();
+
+        // now lets try read them!
+        BufferedInputStream in = new BufferedInputStream(new FileInputStream(fileName));
+        CodedInputStream cin = CodedInputStream.newInstance(in);
+        for (int i = 0; i < messageCount; i++) {
+            OpenWire.Message message = OpenWire.Message.parseFrom(cin);
+            // todo test its not null or something?
+
+            System.out.println("Reading message: " + i + " = " + message);
+
+        }
+        in.close();
+    }
+
+}

Propchange: activemq/trunk/activemq-protocol-buffer/src/test/java/org/apache/activemq/protocolbuffer/PerformanceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message