Skip to content

Commit 84b571d

Browse files
author
Emile Joubert
committed
0.9.1 codegen
1 parent 62d173b commit 84b571d

File tree

13 files changed

+338
-122
lines changed

13 files changed

+338
-122
lines changed

RabbitMQDotNetClient.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
Microsoft Visual Studio Solution File, Format Version 9.00
2+
Microsoft Visual Studio Solution File, Format Version 10.00
33
# Visual Studio 2008
44
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "projects", "projects", "{068D7DC3-8E6E-4951-B9E3-272C641BF0DE}"
55
EndProject

projects/client/Apigen/src/apigen/Apigen.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,14 @@ public void EmitContentHeaderFactory(MethodInfo method) {
841841
string contentClass = factoryAnnotation.m_contentClass;
842842
EmitModelMethodPreamble(method);
843843
EmitLine(" {");
844-
EmitLine(" return new "+MangleClass(contentClass)+"Properties();");
844+
if (Attribute(method, typeof(AmqpUnsupportedAttribute)) != null)
845+
{
846+
EmitLine(String.Format(" return default({0});", method.ReturnType));
847+
}
848+
else
849+
{
850+
EmitLine(" return new " + MangleClass(contentClass) + "Properties();");
851+
}
845852
EmitLine(" }");
846853
}
847854

@@ -1119,7 +1126,10 @@ public void EmitAsynchronousHandlers(ArrayList asynchronousHandlers) {
11191126
EmitLine(" "+method.Name+"(");
11201127
int remaining = parameters.Length;
11211128
foreach (ParameterInfo pi in parameters) {
1122-
if (Attribute(pi, typeof(AmqpContentHeaderMappingAttribute)) != null) {
1129+
if (Attribute(pi, typeof(AmqpUnsupportedAttribute)) != null) {
1130+
// skipping unsupported parameter
1131+
}
1132+
else if (Attribute(pi, typeof(AmqpContentHeaderMappingAttribute)) != null) {
11231133
Emit(" ("+pi.ParameterType+") cmd.Header");
11241134
} else if (Attribute(pi, typeof(AmqpContentBodyMappingAttribute)) != null) {
11251135
Emit(" cmd.Body");

projects/client/RabbitMQ.Client/src/client/api/IModel.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,13 @@ public interface IModel: IDisposable
111111
///<summary>Construct a completely empty content header for
112112
///use with the File content class.</summary>
113113
[AmqpContentHeaderFactory("file")]
114+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9_1")]
114115
IFileProperties CreateFileProperties();
115116

116117
///<summary>Construct a completely empty content header for
117118
///use with the Stream content class.</summary>
118119
[AmqpContentHeaderFactory("stream")]
120+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9_1")]
119121
IStreamProperties CreateStreamProperties();
120122

121123
///<summary>(Spec method) Channel flow control functionality.</summary>
@@ -147,16 +149,20 @@ void ExchangeDeclare(string exchange,
147149
string type,
148150
bool passive,
149151
bool durable,
152+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9_1")]
150153
bool autoDelete,
154+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9_1")]
151155
bool @internal,
152156
[AmqpNowaitArgument(null)]
157+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9_1")]
153158
bool nowait,
154159
IDictionary arguments);
155160

156161
///<summary>(Spec method) Delete an exchange.</summary>
157162
void ExchangeDelete(string exchange,
158163
bool ifUnused,
159164
[AmqpNowaitArgument(null)]
165+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9_1")]
160166
bool nowait);
161167

162168
///<summary>(Spec method) Declare a queue.</summary>
@@ -197,6 +203,8 @@ string QueueDeclare(string queue,
197203
bool exclusive,
198204
bool autoDelete,
199205
[AmqpNowaitArgument(null)]
206+
[AmqpFieldMapping("RabbitMQ.Client.Framing.v0_9_1",
207+
"noWait")]
200208
bool nowait,
201209
IDictionary arguments);
202210

@@ -205,6 +213,8 @@ void QueueBind(string queue,
205213
string exchange,
206214
string routingKey,
207215
[AmqpNowaitArgument(null)]
216+
[AmqpFieldMapping("RabbitMQ.Client.Framing.v0_9_1",
217+
"noWait")]
208218
bool nowait,
209219
IDictionary arguments);
210220

@@ -229,6 +239,8 @@ void QueueUnbind(string queue,
229239
[return: AmqpFieldMapping(null, "messageCount")]
230240
uint QueuePurge(string queue,
231241
[AmqpNowaitArgument(null, "0xFFFFFFFF")]
242+
[AmqpFieldMapping("RabbitMQ.Client.Framing.v0_9_1",
243+
"noWait")]
232244
bool nowait);
233245

234246
///<summary>(Spec method) Delete a queue.</summary>
@@ -242,6 +254,8 @@ uint QueueDelete(string queue,
242254
bool ifUnused,
243255
bool ifEmpty,
244256
[AmqpNowaitArgument(null, "0xFFFFFFFF")]
257+
[AmqpFieldMapping("RabbitMQ.Client.Framing.v0_9_1",
258+
"noWait")]
245259
bool nowait);
246260

247261
///<summary>Start a Basic content-class consumer.</summary>
@@ -519,7 +533,10 @@ void _Private_BasicConsume(string queue,
519533
bool noLocal,
520534
bool noAck,
521535
bool exclusive,
536+
[AmqpFieldMapping("RabbitMQ.Client.Framing.v0_9_1",
537+
"noWait")]
522538
bool nowait,
539+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9_1")]
523540
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8")]
524541
[AmqpFieldMapping("RabbitMQ.Client.Framing.v0_8qpid",
525542
"arguments")]
@@ -534,6 +551,8 @@ void _Private_BasicConsume(string queue,
534551
[AmqpForceOneWay]
535552
[AmqpMethodMapping(null, "basic", "cancel")]
536553
void _Private_BasicCancel(string consumerTag,
554+
[AmqpFieldMapping("RabbitMQ.Client.Framing.v0_9_1",
555+
"noWait")]
537556
bool nowait);
538557

539558
///<summary>Handle incoming Basic.CancelOk methods.</summary>
@@ -542,7 +561,8 @@ void _Private_BasicCancel(string consumerTag,
542561
///<summary>Used to send a Channel.Open. Called during session
543562
///initialisation.</summary>
544563
[AmqpMethodMapping(null, "channel", "open")]
545-
void _Private_ChannelOpen(string outOfBand);
564+
void _Private_ChannelOpen([AmqpUnsupported("RabbitMQ.Client.Framing.v0_9_1")]
565+
string outOfBand);
546566

547567
///<summary>Used to send a Channel.CloseOk. Called during
548568
///session shutdown.</summary>
@@ -663,11 +683,14 @@ void ConnectionTuneOk(ushort channelMax,
663683
[AmqpForceOneWay]
664684
[AmqpMethodMapping(null, "connection", "open")]
665685
void _Private_ConnectionOpen(string virtualHost,
686+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9_1")]
666687
string capabilities,
688+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9_1")]
667689
bool insist);
668690

669691
///<summary>Handle an incoming Connection.OpenOk.</summary>
670-
void HandleConnectionOpenOk(string knownHosts);
692+
void HandleConnectionOpenOk([AmqpUnsupported("RabbitMQ.Client.Framing.v0_9_1")]
693+
string knownHosts);
671694

672695
///<summary>Handle an incoming Connection.Redirect.</summary>
673696
[AmqpMethodDoNotImplement("RabbitMQ.Client.Framing.v0_9_1")]

projects/client/RabbitMQ.Client/src/client/impl/ModelBase.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,14 @@ public abstract void _Private_ConnectionOpen(string virtualHost,
937937
string capabilities,
938938
bool insist);
939939

940+
public void HandleConnectionOpenOk()
941+
{
942+
ConnectionOpenContinuation k = (ConnectionOpenContinuation)m_continuationQueue.Next();
943+
k.m_redirect = false;
944+
k.m_host = null;
945+
k.HandleCommand(null); // release the continuation.
946+
}
947+
940948
public void HandleConnectionOpenOk(string knownHosts)
941949
{
942950
ConnectionOpenContinuation k = (ConnectionOpenContinuation)m_continuationQueue.Next();
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// This source code is dual-licensed under the Apache License, version
2+
// 2.0, and the Mozilla Public License, version 1.1.
3+
//
4+
// The APL v2.0:
5+
//
6+
//---------------------------------------------------------------------------
7+
// Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
8+
// Technologies LLC., and Rabbit Technologies Ltd.
9+
//
10+
// Licensed under the Apache License, Version 2.0 (the "License");
11+
// you may not use this file except in compliance with the License.
12+
// You may obtain a copy of the License at
13+
//
14+
// http://www.apache.org/licenses/LICENSE-2.0
15+
//
16+
// Unless required by applicable law or agreed to in writing, software
17+
// distributed under the License is distributed on an "AS IS" BASIS,
18+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+
// See the License for the specific language governing permissions and
20+
// limitations under the License.
21+
//---------------------------------------------------------------------------
22+
//
23+
// The MPL v1.1:
24+
//
25+
//---------------------------------------------------------------------------
26+
// The contents of this file are subject to the Mozilla Public License
27+
// Version 1.1 (the "License"); you may not use this file except in
28+
// compliance with the License. You may obtain a copy of the License at
29+
// http://www.rabbitmq.com/mpl.html
30+
//
31+
// Software distributed under the License is distributed on an "AS IS"
32+
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
33+
// License for the specific language governing rights and limitations
34+
// under the License.
35+
//
36+
// The Original Code is The RabbitMQ .NET Client.
37+
//
38+
// The Initial Developers of the Original Code are LShift Ltd,
39+
// Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
40+
//
41+
// Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
42+
// Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
43+
// are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
44+
// Technologies LLC, and Rabbit Technologies Ltd.
45+
//
46+
// Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
47+
// Ltd. Portions created by Cohesive Financial Technologies LLC are
48+
// Copyright (C) 2007-2010 Cohesive Financial Technologies
49+
// LLC. Portions created by Rabbit Technologies Ltd are Copyright
50+
// (C) 2007-2010 Rabbit Technologies Ltd.
51+
//
52+
// All Rights Reserved.
53+
//
54+
// Contributor(s): ______________________________________.
55+
//
56+
//---------------------------------------------------------------------------
57+
using System;
58+
using RabbitMQ.Client.Impl;
59+
60+
namespace RabbitMQ.Client.Framing.Impl.v0_9_1 {
61+
public class Connection: ConnectionBase {
62+
public Connection(ConnectionFactory factory, bool insist, IFrameHandler frameHandler)
63+
: base(factory, insist, frameHandler) {}
64+
}
65+
}
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
// This source code is dual-licensed under the Apache License, version
2+
// 2.0, and the Mozilla Public License, version 1.1.
3+
//
4+
// The APL v2.0:
5+
//
6+
//---------------------------------------------------------------------------
7+
// Copyright (C) 2007-2010 LShift Ltd., Cohesive Financial
8+
// Technologies LLC., and Rabbit Technologies Ltd.
9+
//
10+
// Licensed under the Apache License, Version 2.0 (the "License");
11+
// you may not use this file except in compliance with the License.
12+
// You may obtain a copy of the License at
13+
//
14+
// http://www.apache.org/licenses/LICENSE-2.0
15+
//
16+
// Unless required by applicable law or agreed to in writing, software
17+
// distributed under the License is distributed on an "AS IS" BASIS,
18+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+
// See the License for the specific language governing permissions and
20+
// limitations under the License.
21+
//---------------------------------------------------------------------------
22+
//
23+
// The MPL v1.1:
24+
//
25+
//---------------------------------------------------------------------------
26+
// The contents of this file are subject to the Mozilla Public License
27+
// Version 1.1 (the "License"); you may not use this file except in
28+
// compliance with the License. You may obtain a copy of the License at
29+
// http://www.rabbitmq.com/mpl.html
30+
//
31+
// Software distributed under the License is distributed on an "AS IS"
32+
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
33+
// License for the specific language governing rights and limitations
34+
// under the License.
35+
//
36+
// The Original Code is The RabbitMQ .NET Client.
37+
//
38+
// The Initial Developers of the Original Code are LShift Ltd,
39+
// Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
40+
//
41+
// Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
42+
// Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
43+
// are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
44+
// Technologies LLC, and Rabbit Technologies Ltd.
45+
//
46+
// Portions created by LShift Ltd are Copyright (C) 2007-2010 LShift
47+
// Ltd. Portions created by Cohesive Financial Technologies LLC are
48+
// Copyright (C) 2007-2010 Cohesive Financial Technologies
49+
// LLC. Portions created by Rabbit Technologies Ltd are Copyright
50+
// (C) 2007-2010 Rabbit Technologies Ltd.
51+
//
52+
// All Rights Reserved.
53+
//
54+
// Contributor(s): ______________________________________.
55+
//
56+
//---------------------------------------------------------------------------
57+
using RabbitMQ.Client;
58+
using RabbitMQ.Client.Impl;
59+
using RabbitMQ.Util;
60+
61+
namespace RabbitMQ.Client.Framing.Impl.v0_9_1 {
62+
public abstract class ProtocolBase: AbstractProtocolBase {
63+
64+
public override IFrameHandler CreateFrameHandler(AmqpTcpEndpoint endpoint) {
65+
return new SocketFrameHandler_0_9(endpoint);
66+
}
67+
68+
public override IModel CreateModel(ISession session) {
69+
return new Model(session);
70+
}
71+
72+
public override IConnection CreateConnection(ConnectionFactory factory,
73+
bool insist,
74+
IFrameHandler frameHandler)
75+
{
76+
return new Connection(factory, insist, frameHandler);
77+
}
78+
79+
public override void CreateConnectionClose(ushort reasonCode,
80+
string reasonText,
81+
out Command request,
82+
out int replyClassId,
83+
out int replyMethodId)
84+
{
85+
request = new Command(new RabbitMQ.Client.Framing.Impl.v0_9_1.ConnectionClose(reasonCode,
86+
reasonText,
87+
0, 0));
88+
replyClassId = RabbitMQ.Client.Framing.Impl.v0_9_1.ConnectionCloseOk.ClassId;
89+
replyMethodId = RabbitMQ.Client.Framing.Impl.v0_9_1.ConnectionCloseOk.MethodId;
90+
}
91+
92+
public override void CreateChannelClose(ushort reasonCode,
93+
string reasonText,
94+
out Command request,
95+
out int replyClassId,
96+
out int replyMethodId)
97+
{
98+
request = new Command(new RabbitMQ.Client.Framing.Impl.v0_9_1.ChannelClose(reasonCode,
99+
reasonText,
100+
0, 0));
101+
replyClassId = RabbitMQ.Client.Framing.Impl.v0_9_1.ChannelCloseOk.ClassId;
102+
replyMethodId = RabbitMQ.Client.Framing.Impl.v0_9_1.ChannelCloseOk.MethodId;
103+
}
104+
105+
public override bool CanSendWhileClosed(Command cmd)
106+
{
107+
return cmd.m_method is RabbitMQ.Client.Framing.Impl.v0_9_1.ChannelCloseOk;
108+
}
109+
}
110+
}

0 commit comments

Comments
 (0)