Skip to content

Commit

Permalink
Merge branch 'main' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
678098 authored Mar 21, 2024
2 parents 1e53c0f + 33b39ce commit bcde395
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 41 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Tests
name: Checks

on:
push:
Expand All @@ -25,6 +25,8 @@ jobs:

Documentation:
name: Doxygenize
#Only run for push to main
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
40 changes: 21 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,27 @@ preferred package management system, please open an [issue](../../issues/new/cho
## Using `rmqcpp` in your Application
The best way to depend on `rmqcpp` is to setup your project with a git submodule to this repository:
### With vcpkg
1. Add `rmqcpp` in your `vcpkg.json` file to specify dependency:
```
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "testproj",
"version": "1.0.0",
"dependencies": [
"rmqcpp"
]
}
```
2. In your `CMakeLists.txt` add `find_package(rmqcpp REQUIRED)` - which will install `rmqcpp` with all its dependencies.
3. Use the namespace `rmqcpp::` to link to the library, for example - `target_link_libraries(testproj PUBLIC rmqcpp::rmq)`
### With git submodule
Setup your project with a git submodule to this repository:
```
$ tree
Expand Down Expand Up @@ -266,24 +286,6 @@ add_executable(myapplication main.cpp)
target_link_libraries(myapplication rmq bal)
```
Sample `vcpkg.json`:
```
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json",
"name": "testproj",
"version": "1.0.0",
"dependencies": [
"boost-asio",
"boost-iostreams",
"openssl",
"gtest",
"bde"
]
}
```
> We plan to push `rmqcpp` into vcpkg, after which the git submodule won't be necessary and your vcpkg.json file can be shorter.
Example cmake command to configure this application build:
```
Expand Down
26 changes: 19 additions & 7 deletions examples/rmqperftest/rmqperftest_runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
namespace BloombergLP {
namespace rmqperftest {
namespace {

typedef bsl::pair<bsl::shared_ptr<rmqa::Producer>, bsl::string>
ProducerRoutingKeyPair;

class ConsumerCallback {
public:
ConsumerCallback(const ConsumerArgs& args,
Expand Down Expand Up @@ -96,6 +100,18 @@ bsl::string_view queueNameOrRoutingKey(bsl::string_view routingKey,
}
}

void finalizeProducers(bsl::vector<ProducerRoutingKeyPair>& producers)
{
bsl::cout << producers.size() << " producers finished, exiting producers"
<< bsl::endl;
for (bsl::vector<ProducerRoutingKeyPair>::iterator it = producers.begin();
it != producers.end();
++it) {
it->first->waitForConfirms();
}
producers.clear();
}

} // namespace

int Runner::run(const PerfTestArgs& args)
Expand Down Expand Up @@ -179,8 +195,6 @@ int Runner::run(const PerfTestArgs& args)
}

// Create producer
typedef bsl::pair<bsl::shared_ptr<rmqa::Producer>, bsl::string>
ProducerRoutingKeyPair;
bsl::vector<ProducerRoutingKeyPair> producers;
{
bsl::vector<rmqt::QueueHandle>::const_iterator queues;
Expand Down Expand Up @@ -311,12 +325,10 @@ int Runner::run(const PerfTestArgs& args)

producerMessagesSent += 1;

if ((int)producerMessagesSent ==
if ((int)producerMessagesSent >=
args.producer.producerMessageCount) {
bsl::cout << producers.size()
<< " producers finished, exiting producers"
<< bsl::endl;
producers.clear();

finalizeProducers(producers);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/rmq/rmqa/rmqa_connectionstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef INCLUDED_RMQA_CONNECTIONMONITOR
#define INCLUDED_RMQA_CONNECTIONMONITOR
#ifndef INCLUDED_RMQA_CONNECTIONSTRING
#define INCLUDED_RMQA_CONNECTIONSTRING

#include <rmqt_vhostinfo.h>

Expand Down
4 changes: 2 additions & 2 deletions src/rmq/rmqamqp/rmqamqp_heartbeatmanagerimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ void HeartbeatManagerImpl::handleTick(rmqio::Timer::InterruptReason reason)
d_ticksUntilHeartBeat = d_totalTicksUntilHeartBeat;
}
if (d_ticksUntilDisconnect == 0) {
BALL_LOG_ERROR << "Received no heartbeats for " << d_timeoutSeconds
<< "seconds. Triggering connection termination";
BALL_LOG_WARN << "Received no heartbeats for " << d_timeoutSeconds
<< "seconds. Triggering connection termination";
d_killConnection();
d_ticksUntilDisconnect = d_totalTicksUntilDisconnect;
}
Expand Down
21 changes: 11 additions & 10 deletions src/tests/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ target_link_libraries(rmqintegration PUBLIC

target_include_directories(rmqintegration PUBLIC .)

find_package (Python3 COMPONENTS Interpreter REQUIRED)
execute_process (COMMAND "${Python3_EXECUTABLE}" -m venv ${CMAKE_CURRENT_BINARY_DIR}/.venv)

set (ENV{VIRTUAL_ENV} ${CMAKE_CURRENT_BINARY_DIR}/.venv)

execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/.venv/bin/pip install -r ${CMAKE_CURRENT_LIST_DIR}/requirements.txt)

set(PYTEST
${CMAKE_CURRENT_BINARY_DIR}/.venv/bin/python -m pytest
)
if (NOT DEFINED ENV{PYTHON_BINARY})
find_package (Python3 COMPONENTS Interpreter REQUIRED)
execute_process (COMMAND "${Python3_EXECUTABLE}" -m venv ${CMAKE_CURRENT_BINARY_DIR}/.venv)
set (ENV{VIRTUAL_ENV} ${CMAKE_CURRENT_BINARY_DIR}/.venv)
execute_process(COMMAND ${CMAKE_CURRENT_BINARY_DIR}/.venv/bin/pip install -r ${CMAKE_CURRENT_LIST_DIR}/requirements.txt)
set(PYTHON_BINARY ${CMAKE_CURRENT_BINARY_DIR}/.venv/bin/python)
else()
set(PYTHON_BINARY $ENV{PYTHON_BINARY})
endif()

set(PYTEST ${PYTHON_BINARY} -mpytest)
set( PYTEST_ARGS "-q" "-rap" "--maxfail=2" "--tb=short" "--durations=1" "--log-level=error" "-s")


Expand Down

0 comments on commit bcde395

Please sign in to comment.