You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2017/02/04 04:26:33 UTC
activemq-artemis git commit: NO-JIRA: Adding .net example
Repository: activemq-artemis
Updated Branches:
refs/heads/master c60c92697 -> 781e5e64a
NO-JIRA: Adding .net example
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/781e5e64
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/781e5e64
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/781e5e64
Branch: refs/heads/master
Commit: 781e5e64a42f7cbbfac40294a6ce6e33074731ba
Parents: c60c926
Author: Clebert Suconic <cl...@apache.org>
Authored: Fri Feb 3 21:48:18 2017 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Fri Feb 3 23:22:52 2017 -0500
----------------------------------------------------------------------
examples/dotnet/.DS_Store | Bin 0 -> 6148 bytes
examples/dotnet/amqp/.DS_Store | Bin 0 -> 6148 bytes
.../protocols/amqp/dotnet/.vscode/launch.json | 40 +++++++++++++++
.../protocols/amqp/dotnet/.vscode/tasks.json | 33 ++++++++++++
examples/protocols/amqp/dotnet/Program.cs | 39 +++++++++++++++
examples/protocols/amqp/dotnet/project.json | 36 +++++++++++++
examples/protocols/amqp/dotnet/readme.md | 50 +++++++++++++++++++
examples/protocols/amqp/dotnet/run-example.sh | 23 +++++++++
examples/protocols/amqp/dotnet/start-broker.sh | 22 ++++++++
9 files changed, 243 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/781e5e64/examples/dotnet/.DS_Store
----------------------------------------------------------------------
diff --git a/examples/dotnet/.DS_Store b/examples/dotnet/.DS_Store
new file mode 100644
index 0000000..5eb69ec
Binary files /dev/null and b/examples/dotnet/.DS_Store differ
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/781e5e64/examples/dotnet/amqp/.DS_Store
----------------------------------------------------------------------
diff --git a/examples/dotnet/amqp/.DS_Store b/examples/dotnet/amqp/.DS_Store
new file mode 100644
index 0000000..d92dbd4
Binary files /dev/null and b/examples/dotnet/amqp/.DS_Store differ
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/781e5e64/examples/protocols/amqp/dotnet/.vscode/launch.json
----------------------------------------------------------------------
diff --git a/examples/protocols/amqp/dotnet/.vscode/launch.json b/examples/protocols/amqp/dotnet/.vscode/launch.json
new file mode 100644
index 0000000..13d3214
--- /dev/null
+++ b/examples/protocols/amqp/dotnet/.vscode/launch.json
@@ -0,0 +1,40 @@
+/**
+ * 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.
+ */
+
+{
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "name": ".NET Core Launch (console)",
+ "type": "coreclr",
+ "request": "launch",
+ "preLaunchTask": "build",
+ "program": "${workspaceRoot}/bin/Debug/netcoreapp1.1/queue.dll",
+ "args": [],
+ "cwd": "${workspaceRoot}",
+ "externalConsole": false,
+ "stopAtEntry": false,
+ "internalConsoleOptions": "openOnSessionStart"
+ },
+ {
+ "name": ".NET Core Attach",
+ "type": "coreclr",
+ "request": "attach",
+ "processId": "${command.pickProcess}"
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/781e5e64/examples/protocols/amqp/dotnet/.vscode/tasks.json
----------------------------------------------------------------------
diff --git a/examples/protocols/amqp/dotnet/.vscode/tasks.json b/examples/protocols/amqp/dotnet/.vscode/tasks.json
new file mode 100644
index 0000000..f53eedd
--- /dev/null
+++ b/examples/protocols/amqp/dotnet/.vscode/tasks.json
@@ -0,0 +1,33 @@
+/**
+ * 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.
+ */
+
+{
+ "version": "0.1.0",
+ "command": "dotnet",
+ "isShellCommand": true,
+ "args": [],
+ "tasks": [
+ {
+ "taskName": "build",
+ "args": [
+ "${workspaceRoot}/project.json"
+ ],
+ "isBuildCommand": true,
+ "problemMatcher": "$msCompile"
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/781e5e64/examples/protocols/amqp/dotnet/Program.cs
----------------------------------------------------------------------
diff --git a/examples/protocols/amqp/dotnet/Program.cs b/examples/protocols/amqp/dotnet/Program.cs
new file mode 100755
index 0000000..264570e
--- /dev/null
+++ b/examples/protocols/amqp/dotnet/Program.cs
@@ -0,0 +1,39 @@
+\ufeff/**
+ * 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.
+ */
+
+using System;
+using Amqp;
+namespace ConsoleApplication
+{
+ public class Program
+ {
+ public static void Main(string[] args)
+ {
+ string address = "amqp://a:a@localhost:5672";
+
+ Connection connection = new Connection(new Address(address));
+ Session session = new Session(connection);
+ SenderLink sender = new SenderLink(session, "test-sender", "q1");
+
+ Message message1 = new Message("Hello AMQP!");
+ sender.Send(message1);
+
+
+ Console.WriteLine("Message sent into queue q1");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/781e5e64/examples/protocols/amqp/dotnet/project.json
----------------------------------------------------------------------
diff --git a/examples/protocols/amqp/dotnet/project.json b/examples/protocols/amqp/dotnet/project.json
new file mode 100755
index 0000000..7df8f24
--- /dev/null
+++ b/examples/protocols/amqp/dotnet/project.json
@@ -0,0 +1,36 @@
+/**
+ * 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.
+ */
+
+{
+ "version": "1.0.0-*",
+ "buildOptions": {
+ "debugType": "portable",
+ "emitEntryPoint": true
+ },
+ "dependencies": {"AMQPNetLite": "1.2.2"},
+ "frameworks": {
+ "netcoreapp1.1": {
+ "dependencies": {
+ "Microsoft.NETCore.App": {
+ "type": "platform",
+ "version": "1.1.0"
+ }
+ },
+ "imports": "dnxcore50"
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/781e5e64/examples/protocols/amqp/dotnet/readme.md
----------------------------------------------------------------------
diff --git a/examples/protocols/amqp/dotnet/readme.md b/examples/protocols/amqp/dotnet/readme.md
new file mode 100644
index 0000000..6a62977
--- /dev/null
+++ b/examples/protocols/amqp/dotnet/readme.md
@@ -0,0 +1,50 @@
+# Running the .NET AMQP example
+
+
+# Pre-requisites:
+
+All of this can be done on Linux, Mac and... Windows
+
+- Install .NET
+
+https://www.microsoft.com/net/core
+
+
+- Visual Studio Code is free and may be useful:
+
+https://code.visualstudio.com
+
+
+- Powershell might be also useful:
+
+https://github.com/PowerShell/PowerShell/
+
+
+
+# running the example
+
+- Create the broker, by running:
+
+```
+../../../../bin/artemis create ./server1 --user a --password a --role a --allow-anonymous --force
+./server1/bin/artemis-service start
+```
+
+Or simply use the start-broker.sh script on this directory
+
+
+- Compile the code
+
+You need to restore the package, build and run so .NET may download your packages from NuGET:
+
+```sh
+dotnet restore
+dotnet build
+dotnet run
+```
+
+Or simply use the run-example.sh script on this directory
+
+- Debugging
+
+Visual Studio Code will make it fairly easy to do it
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/781e5e64/examples/protocols/amqp/dotnet/run-example.sh
----------------------------------------------------------------------
diff --git a/examples/protocols/amqp/dotnet/run-example.sh b/examples/protocols/amqp/dotnet/run-example.sh
new file mode 100755
index 0000000..efcd53b
--- /dev/null
+++ b/examples/protocols/amqp/dotnet/run-example.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env sh
+# 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.
+
+echo "Make sure you run start-broker.sh first"
+
+dotnet restore
+dotnet build
+dotnet run
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/781e5e64/examples/protocols/amqp/dotnet/start-broker.sh
----------------------------------------------------------------------
diff --git a/examples/protocols/amqp/dotnet/start-broker.sh b/examples/protocols/amqp/dotnet/start-broker.sh
new file mode 100755
index 0000000..1f193da
--- /dev/null
+++ b/examples/protocols/amqp/dotnet/start-broker.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env sh
+# 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.
+
+# if you are using a source distribution you will have to create and start the broker manually
+# Use this as a reference!
+../../../../bin/artemis create ./server1 --user a --password a --role a --allow-anonymous --force
+./server1/bin/artemis-service start